I'm working with the google maps API, and testing a section which geocodes all the addresses in a database which do not have coordinates, then generates a report of which were successful, and which failed.
If any of the locations couldn't be found, it should put a form at the top of the page to allow the user to either modify the address or specify coordinates.
I know that the geocoder can call back my code with the G_GEO_UNKNOWN_ADDRESS
status code, but it never uses it. I put fake addresses into the database and got this:
The coordinates of 1337 Rawrmander Rd. Were successfully set to: latitude: 49.170171 longtitude: -123.136579 The coordinates of 5678 Imaginary Lane Were successfully set to: latitude: 49.170171 longtitude: -123.136579
It just gave back the center of the city (and continues to do so no matter what the address is) instead of calling it an unknown address.
This is how I call the geocoder:
//in a for loop
setTimeout( "geocoder.getLocations(\"" +
//address to send to google
values[i]['house'] + " " +
values[i]['street'] + " " +
values[i]['streetType'] + ", " +
"Richmond, BC, Canada\", " +
//google returns to this function asynchronously
"function(reply) { handleReply(processItem++, reply); } );"
,
callTimeout);
callTimeout += 220;
I tried changing "Richmond, BC, Canada"
to just "Richmond"
in hopes that it would not know which city to pick and then return an unknown address, but instead it just picked the middle of Richmond, VA.
Does anyone know a way to "hint" at google to give me an unknown address instead of just picking anything?