I want to know whether a point is on land or water using google maps geocoding api.
If I give my coordinate point as (40,-74) which is on water body, I am still getting address which is shown below.
the address is:1416 Highland Ave, Cinnaminson, NJ 08077, USA results[0].geometry.locationType:ROOFTOP results[0].types[0].toString():street_address(which has to be "natural_feature")
I am using java client library to do this. Anyone help me because I have strucked up here and has to submit my assignment where soon. Thanks in Advance.
You can filter results of reverse geocoding by result type and location type. In result type you can look for natural_feature and location type should be GEOMETRIC_CENTER or APPROXIMATE to exclude any ROOFTOP address that can be close to given point on the land.
Please have a look at the following request:
The first two items in response are:
Now if I execute the same request for the point on the land:
The first result will be 'Drum Point Rd, Brick, NJ 08723, USA' of type route.
Hope it helps.