Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find nearest airport using lat long

Tags:

json

c#

I am trying to find out nearest airport code using latitude and longitude. I find URL which give me nearest airport:

http://airports.pidgets.com/v1/airports?near=40.1584,-74.9732

but problem is that this URL give 8 airports codes. How can i find out nearest airport within this 8 airports code.

Any suggestion.

like image 960
Harshit Tailor Avatar asked Nov 20 '25 16:11

Harshit Tailor


2 Answers

The <dist> is included, and appears to be in ascending order. So: take the first.

If you don't trust it, compute the great arc distance ;p

like image 166
Marc Gravell Avatar answered Nov 23 '25 05:11

Marc Gravell


The resulting XML gives you a <dist> node which appears to give you the distance. So just take the one with the lowest <dist> value (seems to be ordered, so take the first).

like image 29
germi Avatar answered Nov 23 '25 06:11

germi