Determine if a point reside inside a leaflet polygon

前端 未结 3 1559
故里飘歌
故里飘歌 2020-12-05 05:10

Suppose I Draw a polygan using leaflet like in the follow demo: http://leaflet.github.io/Leaflet.draw/

My question is how I can determine if a given point reside ins

3条回答
  •  天涯浪人
    2020-12-05 06:08

    I found that none of the above answers worked for counting markers within non-contiguous polygons. Here's an example polygon where the above functions returned 0 markers inside:

    For anyone who needs to do that, the Leaflet.PointInPolygon package worked for me: https://github.com/hayeswise/Leaflet.PointInPolygon

    It's a bit slow, but it seems to be accurate.

提交回复
热议问题