HotSopt

28 views
Skip to first unread message

Tim Jackson

unread,
Nov 15, 2015, 11:13:24 AM11/15/15
to Leaflet
Any one know of an easy way to find out if a given Point is within a Polygon.

ie.
A map has an area on it defended by a Polygon.
I have a coordinate defended as a Point on the map.
I want to know if the Point is inside the Polygon?

Any one know of any simple script (java) to work this out?

ghybs

unread,
Nov 15, 2015, 8:39:01 PM11/15/15
to Leaflet
Hi,

Java or JavaScript?

For JavaScript, you could simply use Mapbox's Point in Polygon plugin for Leaflet (https://github.com/mapbox/leaflet-pip).
If you need more complex operations, try Turf (https://github.com/turfjs/turf).

Hope this helps.

Tim Jackson

unread,
Nov 26, 2015, 12:20:48 PM11/26/15
to Leaflet

Thank you I will take a look
Reply all
Reply to author
Forward
0 new messages