I am trying to geocode addresses to determine whether or not they are in our delivery area for our service.
For most addresses, it is working just fine; It either informs the customer that they are outside of our delivery area, or it sets their zone and allows them to continue. *However*, sometime in the last 6 weeks the API stopped working and no longer returns ZERO_RESULTS for non-existent addresses as described here: http://code.google.com/apis/maps/documentation/javascript/services.html#GeocodingStatusCodes If I use an address such as 123 Nowhere St. or 34 Gobbledygook Ln. or 44 Bullhockey Rd., I get a status of "OK" and a LatLng object with the coordinates of the city center. This means that anyone can type in *any* *fake* address and be treated as if they were inside our area. For example, 123 Nowhere St. Durham, NC returns (35.9940329, -78.898619) which is the same result as typing "Durham, NC" into maps.google.com. Here is a link to the page displaying this behavior: https://www.scratchtakeout.com/cgi-bin/geocodeTest.pl (note: I have it set to alert(status + ' ' + google.maps.GeocoderStatus.OK) for debugging - both always show up as "OK") Here is my full code: var geocoder; //this is global > 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; > } > }); > } > Does anyone know why the JS V3 API would return a status of "OK" even for a non-existent address? It certainly used to work - and I haven't changed anything that I can remember. 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/-/C9HNMSSIZDYJ. 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.
