我正在尝试将一组样式应用于带有标记的地图。这是基于我正在努力以任何可能的方式组合的两个功能示例。不用说,我还没有成功。
这是我的想法:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px; }
#map_canvas { height: 80% ; width:100%; //*position:(100,0);*//}
#content {}
</style>
<script type="text/javascript"
src="http://maps-api-tt.appspot.com/apilite/styled/apiv3.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(51.795624, 15.724284);
var settings = {
zoom: 18,
center: latlng,
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DEFAULT},
navigationControl: false,
navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
var styles = {
"map_canvas": [
{
featureType: 'all',
rules: [
{ "invert_lightness": true },
{ "weight": 0.5 },
{ "lightness": 5 },
{ "gamma": 1.58 },
{ "saturation": 2 }
]
}
]
};
var map = new google.maps.Map(document.getElementById("map_canvas"), settings);
var contentString = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h1 id="firstHeading" class="firstHeading">heading</h1>'+
'<div id="bodyContent">'+
'<p>sample txt</p>'+
'</div>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var companyImage = new google.maps.MarkerImage('images/logoo.png',
new google.maps.Size(337,191),
new google.maps.Point(0,0),
new google.maps.Point(50,50)
);
var companyShadow = new google.maps.MarkerImage('images/logoo_shadow.png',
new google.maps.Size(337,191),
new google.maps.Point(0,0),
new google.maps.Point(50,50)
);
var companyPos = new google.maps.LatLng(51.796414, 15.724155);
var companyMarker = new google.maps.Marker({
position: companyPos,
map: map,
icon: companyImage,
shadow: companyShadow,
title:"Kacza Górka Park Sportowy",
zIndex: 3});
var skateImage = new google.maps.MarkerImage('images/skate.png',
new google.maps.Size(100,100),
new google.maps.Point(0,0),
new google.maps.Point(50,50)
);
var skateShadow = new google.maps.MarkerImage('images/skate_shadow.png',
new google.maps.Size(100,100),
new google.maps.Point(0,0),
new google.maps.Point(50,50)
);
var skatePos = new google.maps.LatLng(51.795623, 15.724286);
var skateMarker = new google.maps.Marker({
position: skatePos,
map: map,
icon: skateImage,
shadow: skateShadow,
title:"skate park",
zIndex: 2
});
var parkingImage = new google.maps.MarkerImage('images/parking.png',
new google.maps.Size(50,50),
new google.maps.Point(0,0),
new google.maps.Point(50,50)
);
var parkingShadow = new google.maps.MarkerImage('images/parking_shadow.png',
new google.maps.Size(70,50),
new google.maps.Point(0,0),
new google.maps.Point(60, 50)
);
var parkingPos = new google.maps.LatLng(57.0437, 9.9147);
var parkingMarker = new google.maps.Marker({
position: parkingPos,
map: map,
icon: parkingImage,
shadow: parkingShadow,
title:"Parking Lot",
zIndex: 1
});
google.maps.event.addListener(companyMarker, 'click', function() {
infowindow.open(map,companyMarker);
});
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas"></div>
</body>
我已经尝试了一段时间,但无法弄清楚,我会感谢所有输入。