I'm a customer at another paid geocoding service and evaluate Google's Geocoding API currently. I know there has been many questions already, but I have not found an answer.
Please run this query yourself to understand the problem.
The correct street is "semptstr." runnig the query with a small typo "semstr" will give confusing results.
https://maps.googleapis.com/maps/api/geocode/json?address=semstr. 21 85457 woerth Germany&key={{YOUR KEY}}
If you geocode the address above it does print location_type "ROOFTOP", which I consider to be a direct match.
The address geocodes into following
{
"results" : [
{
"address_components" : [
{
"long_name" : "21",
"short_name" : "21",
"types" : [ "street_number" ]
},
{
"long_name" : "Seestraße",
"short_name" : "Seestraße",
"types" : [ "route" ]
},
{
"long_name" : "Rettenbach",
"short_name" : "Rettenbach",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Oberpfalz",
"short_name" : "Oberpfalz",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Bayern",
"short_name" : "BY",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Deutschland",
"short_name" : "DE",
"types" : [ "country", "political" ]
},
{
"long_name" : "93191",
"short_name" : "93191",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "Seestraße 21, 93191 Rettenbach, Deutschland",
"geometry" : {
"location" : {
"lat" : 49.07218,
"lng" : 12.45707
},
"location_type" : "ROOFTOP",
"viewport" : {
"northeast" : {
"lat" : 49.07352898029149,
"lng" : 12.4584189802915
},
"southwest" : {
"lat" : 49.07083101970849,
"lng" : 12.4557210197085
}
}
},
"partial_match" : true,
"place_id" : "ChIJHdXdJbnhn0cRgImKyuFq2UM",
"types" : [ "street_address" ]
}
],
"status" : "OK"
}
If you look at the result it says ROOFTOP and there are no fields about the accuracy. I consider ROOFTOP to be an exact match.
Actually it's not even close the location from the query. The postal code 93191 is in a different city, which is around 150 kilometers away.
I'm looking for a relevance parameter. I know APPROXIMATE, INTERPOLATED exists, but in this case it is not displayed in the result.
Such results are not usable for serious production or commercial applications in my case, unless I missed an additional query parameter.
Bounding boxes are not possible either, because I do not have the coordinates of the city. It would make me run the query twice which would result into double costs and double usage.
Comparing the postal codes will just result into very strict behaviour of the function.
So, how can we find out based on the query that the address was not an exact match? Are there any parameters which I missed?
I could not find any official documentation for this but going through some of the answers on this community i found that ROOFTOP means the most accurate result.
According to the answer posted here and here-
The API will return either ROOFTOP, GEOMETRIC_CENTER, RANGE_INTERPOLATED or APPROXIMATE. Rooftop is essentially "dead on" -- the API resolved the address to a building. Other than that, you get varying degrees of "close".
"ROOFTOP" -> 9 [Everything else] -> 4 to 8 (aka the text string might as well read "GARBAGE")