Reputation: 41
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.
Upvotes: 2
Views: 10834
Reputation: 5602
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
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.
Upvotes: 0
Reputation: 2682
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>
Upvotes: 1