Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 - api.geonames.org/… returns an error if not on land - this one api.geonames.org/… returns vaild oceans combine the two for a simple api response –  Mapperz Mar 20 '12 at 21:43
add comment

2 Answers

Look at the "DISTANCE POINT TO POLYLINE OR POLYGON Demo" at:

[This is a Google Maps V2 not v3 demo]

http://www.bdcc.co.uk/Gmaps/BdccGmapBits.htm

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 http://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html

"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 http://wtp2.appspot.com/cSnapToRouteDemo.html

share|improve this answer
add comment

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. http://www.maprisk.com It looks old fashioned but the new enhanced version is coming soon! I hope I could help!

Cheers

Tamas

share|improve this answer
add comment

Your Answer

 
discard

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.