1

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.

Jake Zerrer
  • 304
  • 2
  • 9
  • 2
    Google reverse Geocoding does this – Coder Feb 01 '17 at 22:40
  • 1
    Possible duplicate of [this stackoverflow answer](http://stackoverflow.com/questions/6548504/how-can-i-get-city-name-from-a-latitude-and-longitude-point). – M Miles Feb 01 '17 at 22:43
  • @Coder I can find no reference to this specific functionality in Google's [Reverse Geocoding API Documentation](https://developers.google.com/maps/documentation/geocoding/intro). The only way I can think of to use this API to determine if one region contains a list of locations is to reverse geocode each location independently and then look for similarities in individual `"address_components"`. However, this would require an API call for every location, which would be impractical in my situation. – Jake Zerrer Feb 02 '17 at 16:21
  • @MMiles That question is asking about reverse geocoding. My question is about determining which items in a set of locations are contained within a region. – Jake Zerrer Feb 02 '17 at 16:27
  • 1
    @JakeZerrer Bing maps have specific restrictions to reverse geocode and you can specify the entityTypes which varies from address to country follow the link https://msdn.microsoft.com/en-us/library/ff701710.aspx I couldn't find an API where you can make multiple geocode requests in a single call though. – Coder Feb 02 '17 at 17:17

1 Answers1

1

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.

mattficke
  • 727
  • 4
  • 9