Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm building an iPhone app that often ends up in a point that is in the middle of the ocean. I want to be able to find the nearest landmasses, which in some casses are thousands of miles away.

So far I've thought of calling the maps API on the regions NW, NE, SW, SE - i.e. the ocean coordinate +10 lat, +10 long etc. until I come up with a response that isn't ZERO_RESULTS (I could obviously keep expanding the bounding box until I found something). I'm currently trying to find info on the antipode to San Francisco, which is approximately -37, 56.

The clear limitation on this is that it is in no way scalable, since Google has a request limit of 2,500 per day and I would probably be making 4+ of them per entry by a user (and I expect a user to make at least a few of these requests per use).

Any thoughts?

Thanks, Alex

share|improve this question
Do you have to use Google Maps API? – Mapperz Mar 20 '12 at 20:40
Nope, happy to use anything else that will work on an iPhone. (i.e. an SDK or REST API) – AlexSBerman Mar 20 '12 at 20:42
another option is -… returns an error if not on land - this one… returns vaild oceans combine the two for a simple api response – Mapperz Mar 20 '12 at 21:43


[This is a Google Maps V2 not v3 demo]

SO if you have a polygon/polyline of the sea you can quickly find the distance from a point in the sea - it the reverse of this demo. Data (Coastline) can be downloaded and added to Fusion Tables

"This uses some 3D geometry maths to work out the distance between the mousepointer's lat/lng and a GPolyline (or border of a GPolygon). The distance in metres is displayed in a panel on the bottom right of the map.

You can test this by panning the map so that a vertex of the polyline lies on one end of the scale bar and then moving the mousepointer to the other end of the scale bar. Also, if you zoom well in, then the distance should stay around 1m or less as you move the mousepointer all along the polyline. The test polyline has horizontal and vertical sides of 2km so the furthest away you can get inside its square is 1000m.

Source code for the distance calculation is available too.

This code can be used for determining how far 'Off Route' a point is or for filtering 'Points Of Interest' for proximity to a route. I have used it with the GSHHS data set to find out how far it is to the sea.

There is a similar, better demo here

share|improve this answer

Maybe it sounds crazy, but why don't you create your own database from points generated by shorline shapefiles? Based on such database, you can create an API (your own) that you can easily query later on whenever you want and unlimited times. It is just my suggestion and to show what I am thinking of, here is a link to an app that I created which does the exact opposite i.e. searching for the nearest sea from within a custom user defined point in the US. It looks old fashioned but the new enhanced version is coming soon! I hope I could help!



share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.