Just geocode the address you receive, then compute the distance between 
what you provided and what you got back.  Decide on a threshold (based on 
the source of  your lat-lng in the first place) for what reverse geocoding 
you will accept.

Reverse geocoding generally returns the lat-lng of the top of the house. 
 If you are using a lat-lng from, for instance, routing data, the lat-lng 
you have may be the street in front of the house, which could easily be 100 
meters away.   

Arbitrarily returning "zero results" when the submitted lat-lng is over 
water wouldn't be a very good design.  If your user is "picking" a location 
from a map, it would be very easy for the user to "miss" the exact top of a 
sea-side home and click a location a few meters off the beach.  

- Jeff

On Sunday, January 8, 2017 at 4:35:57 PM UTC-8, Xin Zhang wrote:
>
> Hi,
>
>
> In my project, I'm using Google Geocoding and Reverse Geocoding APIs to 
> validate the addresses and latlngs provided by end users.
>
>
> Given latlng -37.857866,144.950706, the Reverse Geocoding API (
> https://maps.googleapis.com/maps/api/geocode/json?latlng=-37.857866,144.950706)
>  
> returns the nearest land address.
>
> However on Google Map web page, that latlng actually is in the sea: 
> https://www.google.com.au/maps/search/-37.857866,144.950706
>
>
> Is there anyway that I can tell Google Reverse Geocoding API to not return 
> me the nearest land address? In real project, actually I provide the API 
> key and specify location types, e.g. 
> https://maps.googleapis.com/maps/api/geocode/json?key=&location_type=ROOFTOP|RANGE_INTERPOLATED|GEOMETRIC_CENTER&latlng=-37.857866,144.950706
>  
> and I'm just thinking if the place specified by the latlng is not address 
> as specified, Google should return me ZERO_RESULTS.
>
>
> Thanks and regards,
>
> Eric
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-maps-js-api-v3+unsubscr...@googlegroups.com.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
Visit this group at https://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/d/optout.

Reply via email to