Search code examples
javascriptgoogle-mapsgoogle-apigoogle-places-autocomplete

Autocomple form finds city but cannot access it


Google place autocomplete address form doesn't return locality even tough it show it in the autocomplete? Using their original example as well as trying to change locality for postal_town I cannot acces city name.

It is quite perplexed situation where I can see city's name 'Presov' in the autocomplete form but I cannot access it with locality nor postal_town. Any ideas?

An example in question


Solution

  • So, finally figured it out. In my case I called https://maps.googleapis.com/maps/api/geocode/json?address=Matice+Slovenskej,+Presov,+Slovakia&key=YOUR_API_KEY where you can see the response in JSON key and all the specific fields that are returned. I was not able to find this info in official documentation.