Hi, Please help.
I have four KML files. And I am using them in Maps API V3 (see code
below). Everything worked fine, but I am not able to display each KML
files with a custom icon. For example, KML file 1 should use a green
icon, KML file 2 should use a blue icon, KML file 3 should use a
purple icon, and KML file 4 should use a red icon. I also try using
KMZ with icons zip up inside, changes the src code to those custom
icons. but still don't work in Maps V3. Strangely, all these files are
able to display custom icons in Google Earth, just not Maps V3.
Here are my codes.
<script type="text/javascript">
var map;
var toggleState =new Array();
toggleState[0]=0;
toggleState[1]=1;
toggleState[2]=1;
toggleState[3]=1;
// Not using the next two lines below for now.
var image = new Array();
image[0]="
http://labs.google.com/ridefinder/images/mm_20_green.png";
var stipEnv = new google.maps.KmlLayer("
https://sites.google.com/site/
ctd4gis/Home/files/stip_env_pts.kml");
var stipDesign = new google.maps.KmlLayer("
https://sites.google.com/
site/ctd4gis/Home/files/stip_design_pts.kml");
var stipRtl = new google.maps.KmlLayer("
https://sites.google.com/site/
ctd4gis/Home/files/stip_rtl_pts.kml");
var stipConst = new google.maps.KmlLayer("
https://sites.google.com/
site/ctd4gis/Home/files/stip_const_pts.kml");
function initialize() {
var latlng = new google.maps.LatLng(37.789879, -122.390442);
var myOptions = {
zoom: 10,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
stipEnv.setMap(map);
}
function loadStip(num,stipPhase) {
if (toggleState[num] == 1) {
stipPhase.setMap(map);
toggleState[num] =0;
} else {
stipPhase.setMap();
toggleState[num] =1;
}
}
</script>