mapbox / leaflet-pip

point in polygon intersections for leaflet
https://mapbox.github.io/leaflet-pip/
BSD 2-Clause "Simplified" License
199 stars 46 forks source link

Support for Leaflet v 1.0 polygon detections #20

Closed doapp-ryanp closed 8 years ago

doapp-ryanp commented 8 years ago

Fixes https://github.com/mapbox/leaflet-pip/issues/19

doapp-ryanp commented 8 years ago

I thought you wanted to use the code laid out in https://github.com/mapbox/leaflet-pip/issues/8 instead of this? I'm fine using my method (I think it will perform better) but just want to make sure you really want to use mine instead..

doapp-ryanp commented 8 years ago

Re: instance of for detection on if the layer is a poly - from what I could tell in the 5 mins from l looking at the 1.X docs I could not find a clean way. For full transparency tho, this is the 1st time I've ever used Leaflet. I will spend a little more time now digging for more elegant solution.

doapp-ryanp commented 8 years ago

So I'm pretty confident there is no way to use instanceof to tell if its a poly or multi-poly. I think my code while not the most pretty, is the most efficient way to do the detection in v1.X.

To clean up the code a bit, my && l.feature.geometry.type check could probably be removed (as type attr should always be defined) but I put it in there to more gracefully handle bugs in the input GeoJSON.