Reputation: 158
This is the API that I am Using but It is giving only District name and State Name only not giving the name as per postal code. is there any another API to get exact City name. Kindly help me out from this issue.
http://maps.googleapis.com/maps/api/geocode/json?address=&components=postal_code:506366&sensor=false"
Upvotes: 1
Views: 1381
Reputation: 4840
A bit of a tricky one: postcode_localities
is only present when the result is a postal code that contains multiple localities. However, 506366 (India) only overlaps with those localities, it does not contain any of them. That's why you won't have a locality
in the address.
At the same time, there is no postal code that fully contains those locality, so you won't get a postal_code
in their addresses either:
https://maps.googleapis.com/maps/api/geocode/json?&address=Parlapalle%20506366%20india https://maps.googleapis.com/maps/api/geocode/json?&address=Akinepalle%20506366%20india
Here's an example where postcode_localities
is returned: 13100 (France):
https://maps.googleapis.com/maps/api/geocode/json?components=country%3AFR%7Apostal_code%3A13100
Upvotes: 1
Reputation: 32100
Looking at the postal code boundaries on maps.google.com it seems that the postal code overlaps several localities:
In such situation Geocoding API doesn't return a locality in address component because of ambiguity.
However, I would expect the postcode_localities array in the response that according to the documentation
is an array denoting all the localities contained in a postal code. This is only present when the result is a postal code that contains multiple localities.
https://developers.google.com/maps/documentation/geocoding/intro#Results
At this point it looks like a bug. I can suggest raising an issue in the public issue tracker: https://code.google.com/p/gmaps-api-issues/
Upvotes: 1