How to get the equivalent of the accuracy in Google Map Geocoder V3

前端 未结 3 2022
说谎
说谎 2021-01-03 09:46

I want to get geocode from google, and I used to do it with the V2 of the API. Google send in the json a pretty good information, the accuracy, reference here : http://code.

3条回答
  •  独厮守ぢ
    2021-01-03 09:59

    Paula's answer is good but you do need to also consider John's comment that ROOFTOP can return garbage.

    I use a post-geocode-query sanity checker to get rid of those cases where location_type is 'ROOFTOP' but the address has nothing to do with the address you sent to google - this sanity checker compares the new address with the old address and considers what changed and by how much. The google geocoder is good at fixing typos, sometimes, but it can also make some non-sensical decisions - for instance choose a different city, a different state, or a different country. You need to decide if the result is a fix in a typo or if the geocode logic went astray.

    So, don't just assume ROOFTOP == 9. It can also be garbage if the new address is way off from the original that you sent.

    For things like Apartments or building with multiple units, the location_type = 'RANGE_INTERPOLATED' may also be accurate when the result type is 'subpremise'.

    Remember, geocoding is not the same thing as address validation. They have some overlap but google geocode logic tries too hard to get you an answer, even when your input is garbage.

提交回复
热议问题