2

I am working to get the latitude and longitude of nearest POI like airports, schools around a secondary latitude and longitude. So far i have searched and found the following API

http://maps.googleapis.com/maps/api/geocode/json?address=airport,Nashik&sensor=false

Unfortunately it works with the address instead of the secondary latitude and longitude. and if I insert the latitude and longitude it gives me the address of that point.
Is there a way to find the nearest airport(latitude,longitude) from the provided (latitude,longitude). I am trying this in PHP.

geocodezip
  • 158,664
  • 13
  • 220
  • 245
user3703404
  • 41
  • 1
  • 6
  • Possible duplicate of [Reverse Geocoding With Google Map API And PHP To Get Nearest Location Using Lat,Long coordinates](http://stackoverflow.com/questions/2054635/reverse-geocoding-with-google-map-api-and-php-to-get-nearest-location-using-lat) – el solo lobo Sep 09 '16 at 14:14
  • @elsololobo i want the POI coordinates based on some provided coordinates – user3703404 Sep 09 '16 at 14:17

2 Answers2

1

Please take a look at Google Places API

It's not that it fully meets your requirements and it has its limitations ("the maximum allowed radius is 50,000 meters", "radius must not be included" if you specify rankby = distance), but you can give it a try anyway.

Your requests could look like this

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.712784,-74.005941&rankby=distance&type=airport&key=<Your API Key>

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.712784,-74.005941&radius=50000&type=airport&key=<Your API Key>
Anatolii Suhanov
  • 2,524
  • 1
  • 12
  • 14
  • 6
    This returns everything that is tagged as `airport`. I ran a few sample requests and their tagging is grossly wrong. Anything that is close to the airport or in the airport is tagged as airport and hence gets returned as well. – Suhas Jun 21 '17 at 10:51
0

You can use Aeris Weather api. Here's the documentation https://www.aerisweather.com/support/docs/api/reference/endpoints/places-airports/

You'd want to use closest action with largeairport filter to avoid smaller/non commercial/military airports

ex: https://api.aerisapi.com/places/airports/closest/p={lat,lng}&limit=5&radius=50miles&filter=largeairport&client_id={ID}&client_secret={SECRET}

You can query using other place params too https://www.aerisweather.com/support/docs/api/reference/places/

A PHP package for the api https://packagist.org/packages/mariohbrino/aeris

They have 6 months free trial and then its $23/month for basic plan.

Manoj
  • 5,542
  • 9
  • 54
  • 80