With Google Maps API V3, determine if a marker is inside a KML Layer boundary

后端 未结 4 983
情话喂你
情话喂你 2021-02-02 04:10

Is there a way to determine if a marker has entered an area covered by a KmlLayer? My .kml is mostly made up of a with a bunch of coordinates that

4条回答
  •  情歌与酒
    2021-02-02 04:48

    Here is a great answer for how to convert KML to Google Maps V3:

    How to Check if a Point is in KML Polygon (GIS Shapefile)

    use a third party parser like geoxml3 or geoxml-v3 to render your KML as native Google Maps API v3 polygons, then use the way you know how. example using geoxml3

    The example given converts KML to Polygons, takes an address as input, geolocates it to get the lat/long and then determines what polygon the point is in:

    http://www.geocodezip.com/geoxml3_test/v3_collection-map2e.html

提交回复
热议问题