Reputation: 604
Google geocoding api returns result for these zip codes: "0", "00", "000" ,"00000"
After hitting this api - https://maps.googleapis.com/maps/api/geocode/json?address=00000&key=mysecretkey it returns "formatted_address" : "6009 Wayzata Blvd Suite #108, St Louis Park, MN 55416, USA"
are these valid zip codes? Ideally it should not return result.
Upvotes: 0
Views: 1368
Reputation: 32100
There are a couple of things you should be aware of:
When you send address=00000
parameter in Geocoding API request, it will search match in formatted address or in place name. Service won't match only postal code in this case.
Google might have bad data in their database that can lead to unexpected results.
In your example it seems to be bad data in Google database.
Let's have a look at the response for your request
https://maps.googleapis.com/maps/api/geocode/json?address=00000&key=YOUR_API_KEY
as you can see in the response, the place ID is "ChIJgyA2iZU0s1IReyHBw0yPjZg". Now check the output of place details request for this place ID
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJgyA2iZU0s1IReyHBw0yPjZg&key=YOUR_API_KEY
The response will contain the following
{
....
id: "3fff72184719b7835304f285f40e677e9914933e",
international_phone_number: "+1 763-300-8722",
name: "00000",
place_id: "ChIJgyA2iZU0s1IReyHBw0yPjZg",
formatted_address: "6009 Wayzata Blvd Suite #108, St Louis Park, MN 55416, USA",
types: [
"lodging",
"point_of_interest",
"establishment"
],
.....
}
Note that this business has name "00000" in Google database, so Geocoding API is working as intended, but obviously there is a data issue here.
You can see the place and report bad data to Google using this link
https://maps.google.com/?cid=10992599825345749371
I hope this helps!
Upvotes: 2