Get only IATA code with geocoding

后端 未结 3 936
囚心锁ツ
囚心锁ツ 2021-02-13 20:49

How can I have just the IATA codes with Google Maps? I just found out how to get the address and city, but I need to grab just the IATA code, like NYC or JFK etc. How can I do t

相关标签:
3条回答
  • 2021-02-13 21:19

    You could use the Global Airport Database. It has GPS coordinates.

    0 讨论(0)
  • 2021-02-13 21:26

    The Google geocoder will not return the IATA code if you reverse geocode a location. It does return a location if you give it an IATA code.

    You can geocode KJFK at https://google-developers.appspot.com/maps/documentation/javascript/examples/geocoding-simple (it places a marker at 40.64384360,-73.78230350).

    If you reverse-geocode that location with https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse you get lots of data but neither three-letter nor four-letter code are included. (The formatted address includes "JFK" but that can't be guaranteed: you would need it as an identifiable data item)

    If you want to find an IATA code for a particular location, you will need to use another resource.

    0 讨论(0)
  • 2021-02-13 21:34

    You can try use this service:

    GET Request Params: http://iatageo.com/getCode/{lat}/{lng}

    GET Request Example: http://iatageo.com/getCode/-15.4343434/-47.323232

    This will return a JSON, for example:

    {
      "code": "BSB",
      "distance_meters": "127763.232556459"
    }
          

    0 讨论(0)
提交回复
热议问题