geejay
geejay

Reputation: 5618

How to find the ocean using Google Maps API

I am trying to figure out where the ocean is in an arbitrary Google Maps view.

I actually have the lat lon (a range of points, when joined together form the coastline) of the coastline. But how do I tell which side of this line is the coastline?

One possible solution would be to find the latlon of the nearest service or town or business or something, and then the ocean is obviously on the other side (given a small enough enclosing polygon).

Is there a better way?

Upvotes: 4

Views: 3351

Answers (2)

Kevin Sedgley
Kevin Sedgley

Reputation: 1069

How about the Google Maps Elevation API?

Watch out for The Netherlands, it's below sea level, as I'm sure many other places are.

Upvotes: 0

RedBlueThing
RedBlueThing

Reputation: 42532

There is nothing in the Google Maps API that will tell you if an arbitrary point is on land or sea.

You wouldn't need the nearest service, town or business as a starting point. I think you could build a heuristic that reverse geocoded a handful of arbitrary points on one side of you coast line and check for the G_GEO_UNKNOWN_ADDRESS result. Some locations on land will be unknown, but if you reverse geocode a few, you should be able to come up with a useful result.

There are a couple of existing StackOverflow questions that might be useful:

Upvotes: 1

Related Questions