Closed doapp-ryanp closed 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..
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.
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.
Fixes https://github.com/mapbox/leaflet-pip/issues/19