I have a Google map, with placemarks from a .kmz file, and an "AddListener" event to display customized placemark information when a placemark is clicked : http://Bus.w.pw/DefaultIconAddListener.html :
<script src=https://Maps.GoogleAPIs.com/maps/api/js?v=3.exp&sensor=false></script>
<script>
function I() {
M = new google.maps.Map(document.getElementById('D'), {
center: new google.maps.LatLng(43.31,-0.36),
zoom: 14
})
L = new google.maps.KmlLayer({url: 'http://Bus.w.pw/TA.kmz', suppressInfoWindows: true})
L.setMap(M)
google.maps.event.addListener(L, 'click', function(E) {
W = new google.maps.InfoWindow({content: 'Customization' + E.featureData.description, position: new google.maps.LatLng(E.latLng.lat(),E.latLng.lng())})
W.open(M)
})
}
google.maps.event.addDomListener(window, 'load', I)
</script>
<div id=D style='width:90%;height:90%'>
But I wanted placemarks to have a custom icon instead of the default Google icon.
To get this result, I use GeoXML3 : http://Bus.w.pw/CustomIconWithGeoXML.html :
<script src=https://Maps.GoogleAPIs.com/maps/api/js?v=3.exp&sensor=false></script>
<script src=GeoXML3.js></script>
<script src=ZipFile.complete.js></script>
<script>
function I() {
M = new google.maps.Map(document.getElementById('D'), {
center: new google.maps.LatLng(43.31,-0.36),
zoom: 14
})
P = new geoXML3.parser({map:M, markerOptions: {icon:'R.png'}, afterParse: S})
P.parse('http://Bus.w.pw/TA.kmz')
}
function S() {
P.showDocument(P.docs[0])
}
google.maps.event.addDomListener(window, 'load', I)
</script>
<div id=D style='width:90%;height:90%'>
Now my question is :
How to have at the same time :
a custom icon for placemarks
and an "AddListener" event, in order to display a customized InfoWindow that depends on the placemark which has been clicked
?