Question

We intend to use the Google Maps Geocoding API on our website. We want to use the Google Places Autocomplete API and convert the address into (X,Y) coordinates with the Geocoder API.

Yet, in France, some postal addresses are formatted with a hamlet or a small village and the city (and those are correct addresses) instead of the classical "number, street and city".

Geocoding response for this kind of addresses is:

  • partial_match = empty
  • location type = GEOMETRIC_CENTER or RANGE_INTERPOLATED
  • type = route

But this is the same response as a street name with no street number.

Is there any way to differentiate the API responses between "hamlets" and "street without number"?
Thanks for any insight.


[EDIT] Here is an example of my issue:

Both returns the same location_type:

  • "location_type" : "GEOMETRIC_CENTER"
Was it helpful?

Solution

Short answer - your Hamlet example is actually resolving a street: Map Link

To answer your general question (guessing you have this happening elsewhere where it is not the street) which is how to tell how the Geocoding API determined the partial match. If you get a route it should mean you have returned a street (with or without number). A Hamlet should show up as a sublocality or a neighborhood if not it's own locality (here in Canada this is what I have seen):

  1. neighborhood
  2. sublocality

*Note though that these are NOT valid mailing addresses in Canada, which makes my examples a little different than your specified criteria.

To know whether the route is an exact match or a guess is where the status codes come in:

From the API Doc's:

"ROOFTOP" indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision.
"RANGE_INTERPOLATED" indicates that the returned result reflects an approximation (usually on a road) interpolated between two precise points (such as intersections). Interpolated results are generally returned when rooftop geocodes are unavailable for a street address.
"GEOMETRIC_CENTER" indicates that the returned result is the geometric center of a result such as a polyline (for example, a street) or polygon (region).
"APPROXIMATE" indicates that the returned result is approximate.

I would expect that you would see GEOMETRIC_CENTER more often for neighborhood and sublocality and RANGE_INTERPOLATED more often for roads - but that is a guess, and I think it depend more on how much data they have on the location and how the algorithm ends up calculating the point.

When you do have a Hamlet returning as a route I do not believe there is any way to tell just from the Geocoding API returned data that this is what happened. The only solution I could think of is to handle those cases in code within your application based on a list of known problems - but I can see this being very problematic and labour intensive.

This perhaps speaks to the hamlet concept as an postal / administrative one which does not translate to mapping data at all? I tried to find La Croix here and had no luck differentiating: http://www.laposte.com/find_a_post_code/find

One more note: If the Geocoding API had resolved the Hamlet as well as the street you should have had multiple results to pick from, e.g. Yarmouth Note the types list at the end tells you the type of results returned as well if you have multiple results: "types" : [ "locality", "political" ]

Update

I needed some more examples for me and decided to look for ones which would also benefit your question. I found this list of French Hamlets. Trying a few I got these results:

  1. Blessey: sublocality
  2. Brétigny: sublocality
  3. Hautacam: Either fails to be found altogether or is a park and shows as a locality
  4. La Mongie: sublocality
  5. Ham/Clergy: locality So looks like there may be some which come up as localities - perhaps a size threshold - many of the sublocalities are incredibly small.

I think you can safely assume that if something evaluates as a route your result is for a street and not a hameaux <-- (and to think I did poorly in French Immersion here in Canada). Also if you get a route and a sublocality in the results it is a safe bet which is which.

Finally if you know the address part you have is a sublocality and NOT a street, and wish to specify this in the address I do not believe Google's API allows that. There are other services that do, like ESRI.I have not used them and do not know the how licencing works in detail, but it appears to have both a free and subscription service much like Google.

And just for completeness - I think I found La Croix using the ESRI site in the "address": "La Croix, L'Île-d'Yeu" entry from that list - downside is that it didn't recognize Fay-de-Bretagne and give a single answer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top