如果在Polygon中不能点击来自KML的点 [英] Can't click point from KML if inside Polygon

查看:191
本文介绍了如果在Polygon中不能点击来自KML的点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好这是场景:


  1. 如果你点击一个带有描述的数据点在标记上它会弹出描述。通过以下方式添加KML图层:
    geoxml = new google.maps.KmlLayer(' http:// MYRURL ' ,{preserveViewport:true});

    geoxml.setMap(map);


  2. 数组直接在地图上使用
    poly = new google.maps.Polygon({
    paths:polyCoords,
    strokeColor:#0000FF,
    strokeOpacity:1,
    strokeWeight:2,
    fillColor:#FF0000,
    fillOpacity:0.2
    });
    ol>

    问题:我可以单击(图像上的绿色箭头),然后查看多边形外点的描述数据,但不能在多边形内的几何图形上显示红色箭头。我也希望看到那些infowindows,Poly AFAIK没有点击监听器。

    我已经测试了setMap在polyMap的setMap前后的KMLLayer ..



    见附图。 >



    感谢

    解决方案

    您的kmllayer正在获取点击事件,而不是具有标记的地图。
    添加clickable:false选项。



    像这样:

      new google.maps.KmlLayer('http:// MYRURL',{preserveViewport:true,clickable:false}); 

    适用于google maps api v3。


    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

    解决方案

    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.

    这篇关于如果在Polygon中不能点击来自KML的点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆