How to get map layers corresponding to LatLng ?

30 views
Skip to first unread message

Guillaume Fillol

unread,
Jul 30, 2015, 10:09:52 AM7/30/15
to Leaflet
Hi all,

Using Leaflet 0.7.3,

My app displays 25 towns, each one is a layer. I use "L.geoJson(..);" to create them, and that works fine.

Now I have latitude/longitude coordinates, and I want to get the town layer corresponding to those coordinates.
How to do this ?

I didn't found anything like layer.isLatLng(..) or something similar...

Thanks a lot for your help.

Bryan McBride

unread,
Jul 31, 2015, 7:49:12 AM7/31/15
to Leaflet
You might want to check out the Leaflet Point In Polygon plugin from Mapbox:https://www.mapbox.com/mapbox.js/example/v1.0.0/point-in-polygon/.

Guillaume Fillol

unread,
Jul 31, 2015, 1:31:06 PM7/31/15
to Leaflet, mcbrid...@gmail.com
Nice, it works fine with the Leaflet PIP plugin !
Thank you Bryan.

I use something like :
leafletPip.pointInLayer(point, towns, true);
Reply all
Reply to author
Forward
0 new messages