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
You could use the Global Airport Database. It has GPS coordinates.
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.
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"
}