Jeff
Jeff

Reputation: 14279

Location not found with Google Maps API

I have an address that is a valid address according to the USPS...

1606 ULSTER AVE, LAKE KATRINE, NY 12449

Searching Google Maps for this address in my browser yields the proper results. However, Google Maps API yields ZERO_RESULTS:

{
   "results" : [],
   "status" : "ZERO_RESULTS"
}

This is happening for about 1% of my locations. Why is the API returning separate results? How do I get it to yield the same results as the browser UI?

Upvotes: 2

Views: 6801

Answers (2)

Jeffrey
Jeffrey

Reputation: 502

Perhaps if you were to validate/standardize the address before submitting it for Google geocoding you would get better results. A quick Google search for "address validation" will give you a number of good tools to do that.

@geocodezip is right that when you remove the ZIP code you get a more predictable response. That might be because the ZIP code is a numeric representation of the city/state combination and is usually regarded as a positive identifier in many tables. However, since the ZIP code can be changed at any time by the US Postal Service, a more consistent response might be obtained (if you encounter issues) by always removing the ZIP code. The problem with always removing the ZIP code is that you have now removed 20% of the address information that you have, and many times a ZIP code can trump a bad city/state combination and still get you valid results.

Consider the following somewhat invalid address: This fails:

275 north main Hollywsdfsdfsdfsdfood CA 84627

If you discard the ZIP code, you get nothing because 275 north main is not a valid address in "Hollywsdfsdfsdfsdfood CA"

However, if you keep the ZIP code and use that instead of the unlikely "Hollywsdfsdfsdfsdfood CA" as the city/state designator, you end up with a completely valid address in Ephraim, Utah 84627.

Here's an example on SmartyStreets since Google Maps was unable to handle it with the bogus city name. The validated address is:

275 N Main St Ephraim UT 84627-1107

So, going back to the idea of address validation BEFORE geocoding, you could then put that address into Google Maps and easily get your geocode. Maybe even keep your current process and then just add a separate routine for the 1% that fail.

[I deal with this kind of thing every day, I work at SmartyStreets]

Upvotes: 1

geocodezip
geocodezip

Reputation: 161404

This is a Places API result, not from the geocoder.

Looks like the zip code is confusing the geocoder, if I remove the zip code, it returns a result:

http://www.geocodezip.com/v3_example_geo2.asp?addr1=1606%20ULSTER%20AVE,%20LAKE%20KATRINE,%20NY&geocode=1

Upvotes: 1

Related Questions