Sometime in the last 6-8 weeks, the Geocoder started returning a status 
code of "OK" instead of "ZERO_RESULTS" for non-existent addresses.

ZERO_RESULTS is the expected response for non-existent addresses as 
documented here:
http://code.google.com/apis/maps/documentation/javascript/services.html#GeocodingStatusCodes

My site uses the geocoder to determine if a person is inside of my service 
area or not.

The API works just fine for addresses that are found; it either tells the 
user that they are not in our delivery area or it allows them to proceed.

*However, *entering a non-existent address such as "1234 nowhere Ln., 
Durham, NC" or "532 Fake St. Durham NC" or "235 Gobbledygook Rd. Durham NC" 
causes the API to return a status of "OK" and results[0] holds the same 
LatLng object as if you type simply "Durham, NC" in maps.google.com.

Is anyone else experiencing this?

Here is a link to the page showing this behavior:
https://www.scratchtakeout.com/cgi-bin/geocodeTest.pl
(I am using alert(status + ' ' + google.maps.GeocoderStatus.OK) for 
debugging, but both say "OK")

Here is our code from that page:

var geocoder;  //this is a global variable 

function initialize() {
>         geocoder = new google.maps.Geocoder();
>     }
>
>     function loadScript() {
>       var mapScript = document.createElement('script');
>       mapScript.type = 'text/javascript';
>       mapScript.src = 
> 'http://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize';
>       document.body.appendChild(mapScript);
>     }
>
>     function codeAddress() {
>         var address = document.getElementById('streetAddress').value;
>         var city = document.getElementById('city').value;
>         var state = document.getElementById('state').value;
>
>         if (address === '') {
>             alert('You must enter a street address!');
>             return false;
>         }
>
>         address = address + ' ' + city + ' ' + state;
>
>         geocoder.geocode( { 'address': address}, function(results, status) 
> {
>           if (status == google.maps.GeocoderStatus.OK) {
>             alert(status + ' ' + google.maps.GeocoderStatus.OK);
>             //whichZone(results[0].geometry.location);
>             return true;
>           } else {
>             showLightbox(320,130,'10px','notFoundChoice');
>             document.getElementById('tryAgain').focus();
>             return false;
>           }
>         });
>     
>

Since all fake addresses return a *real* LatLng object (the city center), 
along with a status of OK, there is no way to determine if a geocode was 
really successful or not.

Any help is appreciated!

-Wes

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-js-api-v3/-/P4vG1ZUh4OcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to