Siva C
Siva C

Reputation: 21

Interpret Google Geocoding API Response returned to know which of them are accurate

We have a program which calls the Google Geocoding API passing an address. we would like to understand for which of the address, the latitude and longitude values are very correct and for which of them it is approximated.

in the response, there are some tags like address_component which can have multiple "type" tag. there is also location_type under 'geometry'-->'location'

There is also 'type' directly 'result'

we are going which the following logic to understand if the lat and long are accurate.

Check for the multiple "type" under "address_components" and if we find either value "route" or "street_number" in any of the type tags, then it is very accurate.. should we use anyother tags from geocoder response like "location_type" under "location" or "type" under "result" tags.

There is some information on Google Geocoding info, but did not figure out if there is a kind of logic we could apply.

Regards Siva

Upvotes: 1

Views: 5018

Answers (1)

geocodezip
geocodezip

Reputation: 161324

The location_type tells you the accuracy of that result, partial match tells you the geocoder did not return an exact match for the request.

See the documentation: Results: location_type/partial match

  • geometry contains the following information:
    • location contains the geocoded latitude,longitude value. For normal address lookups, this field is typically the most important.
    • location_type stores additional data about the specified location. The following values are currently supported:
      • "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.
  • partial_match indicates that the geocoder did not return an exact match for the original request, though it was able to match part of the requested address. You may wish to examine the original request for misspellings and/or an incomplete address. Partial matches most often occur for street addresses that do not exist within the locality you pass in the request. Partial matches may also be returned when a request matches two or more locations in the same locality. For example, "21 Henr St, Bristol, UK" will return a partial match for both Henry Street and Henrietta Street. Note that if a request includes a misspelled address component, the geocoding service may suggest an alternative address. Suggestions triggered in this way will also be marked as a partial match.

Upvotes: 3

Related Questions