Can't click point from KML if inside Polygon

不想你离开。 提交于 2019-12-25 03:13:32

问题


Hi all This is the scenario:

  1. 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);

  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!