Geocoder patch uploaded

Jun 5, 2009 at 6:27 AM

I uploaded patch 3006, however in retrospect it might need one more addition for backwards compatibility:

       internal PointLatLng? GetLatLngFromGeocoderUrl(string url, bool useCache)
          int status = 0;

          return GetLatLngFromGeocoderUrl(url, useCache, out status);

Jun 5, 2009 at 6:43 AM

..but if status is 200 then is ok, if not then return is NULL, so whats the point?

Jun 5, 2009 at 8:24 AM

Because you don't know what happened. I pull a few thousand addresses from a database, and for each address:

- Some addresses will be correct.

- Some addresses will be incorrect and unable to be mapped.

- Some addresses will return a "you're asking too fast, retry later" status, and so a delay needs to be done followed by a retry - by the calling application.

A null cannot cover all these. The calling application can't work out what to do just given that.

There is another change in it to not load geocode's from the cache that say "timed out", because previous versions have stored timed out ones in there, and they will come back forever.


Jun 5, 2009 at 8:27 AM

if it' ok: 200 else 602 what other posible values?

Jun 5, 2009 at 9:03 AM

There's a list at

G_GEO_SUCCESS = 200    
No errors occurred; the address was successfully parsed and its geocode has been returned.
A directions request could not be successfully parsed. For example, the request may have been rejected if it contained more than the maximum number of waypoints allowed.
A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.
The HTTP q parameter was either missing or had no value. For geocoding requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.
No corresponding geographic location could be found for the specified address. This may be due to the fact that the address is relatively new, or it may be incorrect.
The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.
The GDirections object could not compute directions between the points mentioned in the query. This is usually because there is no route available between the two points, or because we do not have data for routing in that region.
G_GEO_BAD_KEY = 610    
The given key is either invalid or does not match the domain for which it was given.
The given key has gone over the requests limit in the 24 hour period or has submitted too many requests in too short a period of time. If you're sending multiple requests in parallel or in a tight loop, use a timer or pause in your code to make sure you don't send the results too quickly.


Jun 5, 2009 at 9:49 AM