1
votes

The goal: Take a list of residential addresses provided by a user, and convert them into lat/lng coordinates. (Suppose the user pastes his list of addresses into a web form)

I am using Google Maps geocoder to get the lat/lng from the address.

I need to verify that each address lookup was "exact". By "exact", I mean, are the lat/lng coordinates something you could deliver a pizza to, or did the geocoder have trouble resolving the address to lat/lng with sufficient accuracy. (For example, if the user forgot to put the house number on one of his addresses.)

I've seen the documentation here: https://developers.google.com/maps/documentation/geocoding/#JSON

My assumption (based on empirical results) is that if the geocoder result meets the following criteria, the result is exact:

  • There is exactly one element in the "results" array
  • results[0]["geometry"]["location_type"] == "ROOFTOP"
  • results[0]["partial_match"] does not exist

Is it correct to assume that if any of these three conditions are not met, the result is probably not exact and should be validated by the user?

Has anyone done something similar and found a tried-and-true way to detect that a result is exact?

1

1 Answers

0
votes

Assume the results are not accuarate.

Place the marker(draggable: true) using geocoder.

Allow the user to drag the marker to the correct position if not correctly located