问题
Hi all This is the scenario:
Have a KML layer with points of data, with description, if you click on marker it will popup description. KML layer added via: geoxml= new google.maps.KmlLayer('http://MYRURL',{preserveViewport:true});
geoxml.setMap(map);Have a polygon made with coords array directly on map with poly = new google.maps.Polygon({ paths: polyCoords, strokeColor: "#0000FF", strokeOpacity: 1, strokeWeight: 2, fillColor: "#FF0000", fillOpacity: 0.2 });
Problem: I can click (Green Arrow on image) and see data of description for points outside polygon but cannot (red arrows on image) of the ones geo-inside the polygon. I will like to see infowindows of those too, Poly AFAIK has no click listener.
I have tested setMap the KMLLayer before and after setMap of poly..
See attached image.
thanks
回答1:
Your kmllayer is getting the click event rather than the map which has the markers on it. Add the "clickable: false" option.
Like so:
new google.maps.KmlLayer('http://MYRURL',{preserveViewport:true, clickable: false});
Works in google maps api v3.
来源:https://stackoverflow.com/questions/9289008/cant-click-point-from-kml-if-inside-polygon