Is Long/Lat within Polygon from GeoJson
·
339 words
·
2 minutes read
This is an example of checking if a pair of long/lat coordinates lie within a polygon or multipolygon when working with geojson. It’s often useful when working with geo-special data and maps to determine if the point your looking is within an area - or which area it’s within.
We use the paulmach/orb
package (see on github), which is deep and precise library for dealing with all sorts of spacial and geometric data. To begin with we load in our geojson file, we’re using an example file, into a feature collection. Then we’re looping through each polygon to check if the point exists within it.
|
|