how to know whether a point is on land or water using google maps api -


i want know whether point on land or water using google maps geocoding api.

if give coordinate point (40,-74) on water body, still getting address 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 "natural_feature")

i using java client library this. me because have strucked here , has submit assignment soon. in advance.

you can filter results of reverse geocoding result type , location type. in result type can natural_feature , location type should geometric_center or approximate exclude rooftop address can close given point on land.

please have @ following request:

https://maps.googleapis.com/maps/api/geocode/json?latlng=40%2c-74&result_type=natural_feature&location_type=geometric_center%7capproximate&key=your_api_key

the first 2 items in response are:

  • north atlantic ocean (type: natural_feature, place id: chijeq3jdsmo3qorbgvpwfckzuq)
  • atlantic ocean (type: natural_feature, place id: chij_7hu48qbwgyrt1mq81cinky)

now if execute same request point on land:

https://maps.googleapis.com/maps/api/geocode/json?latlng=40.044043%2c-74.124069&result_type=natural_feature&location_type=geometric_center%7capproximate&key=your_api_key

the first result 'drum point rd, brick, nj 08723, usa' of type route.

hope helps.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -