I need to load a custom kml file into a Google Map, the code is pretty much unchanged from the appropriate ressources:
function initialize() {
var myLatlng = new google.maps.LatLng(39.397, -100.644);
var myOptions = {
zoom: 5,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
var geoXml = new geoXML3.parser({map: map, processStyles: true});
geoXml.parse('test.kml');
};
The .kml comes straight out of Google Maps, and has a bunch of markers, all with custom icons, for example:
<Style id="sn_1">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/paddle/Z.png</href>
</Icon>
<hotSpot x="32" y="1" xunits="pixels" yunits="pixels"/>
</IconStyle>
<ListStyle>
<ItemIcon>
<href>http://maps.google.com/mapfiles/kml/paddle/Z-lv.png</href>
</ItemIcon>
</ListStyle>
</Style>
Other Icons are defined as (existing) local paths, like:
<Icon>
<href>img/marker/5.png</href>
</Icon>
However, while the map shows just fine, none of the icons get loaded, instead I only get the default Google Maps Icons. Any help with this would be greatly appreciated, since my JavaScript knowledge is pretty limited and I feel I'm at a point where more headscratching won't get me anywhere...
Cheers :)
I solved with tis code:
var marker = new google.maps.Marker({position:point,icon: placemark.style.icon});
this the complete initialization: