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

后端 未结 4 980
情话喂你
情话喂你 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:38

    Now you can get the LatLngBoundary to your KML layer straight from the API

    I supose this will only work on simple KML layers, but once you load your layer you can get the boundary with getDefaultViewport and use it's contains method to check if a LatLng object is within the boundary. This is a extremely easy way to check if a pair of coordinates fits into a KML layer.

提交回复
热议问题