Reputation: 304
I'm looking for an API that does the following:
Given a list of geographic coordinates expressed as lat/long pairs, determine which coordinates lie within a specified geographic location (e.g. California, Brooklyn, the New York Metropolitan Area, or Europe.)
As far as I can tell, neither Mapbox nor any of Google's Places APIs offer this functionality.
Upvotes: 1
Views: 338
Reputation: 797
That question is asking about reverse geocoding. My question is about determining which items in a set of locations are contained within a region.
This is what reverse geocoding does. If you only have the list of coordinates, then you'll need to reverse geocode each one and check the response to see if the point lies within the feature you're interested in.
If you have polygon data for the feature, then you can write a script do a point-in-poly check without needing to use an external service. Quattroshapes is a free source for this kind of data. Use ogr2ogr to convert it to your format of choice (such as geojson) and then use something like Turf to do the point-in-poly check.
Upvotes: 1