tags:

views:

87

answers:

1

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?

+1  A: 

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:

Cannonade