2

As part of a developer challenge, I am trying to determine the land mass closest to a given coordinate. Obviously, if the point is on land, I use reverse geocoding and can get details. The problem is that if the point is in a body of water, especially oceans, it often won't return anything (Google, Nokia, Bing). I'd like to know that a point 3 miles off the coast of California is 3 miles from USA, or x miles from Japan, y miles from South Korea when a point is reasonably near more than one country. Is there any service that provides this information?

Arian Kulp
  • 831
  • 8
  • 31

2 Answers2

2
  • Take a KML file of the world's Maine Regions
  • Simplify it down to a minimum number of rough polygons.
  • Take your location, does it lie within one of the polygons?
    • If your location lies with a polygon, then it is at sea, iterate though the points on the inner and outer boundary to find the nearest one using the Haversine Formula. This will be the nearest point on land.
    • If your location does not lies with a polygon, you are already on land, do a direct reverse geocode.

Just imagine the world is a bit like the board from the game Diplomacy

enter image description here

Now coalesce the sea areas into larger polygons with holes for islands. If you're not at sea you must be on the land right?

Jason Fox
  • 5,115
  • 1
  • 15
  • 34
  • This is a nice solution, but requires more work than what I have time for. Thanks for laying this out. If only Google or Bing handled this automatically! – Arian Kulp May 27 '14 at 16:22
0

check older post in here Verify if a point is Land or Water in Google Maps, check the answer about the Koordinates Vector JSON Query service

Community
  • 1
  • 1
Dr.Jukka
  • 2,346
  • 2
  • 15
  • 20
  • Thanks. This is a good solution, but heavier than what I was hoping for. The natural feature solution doesn't work since when out in the ocean you get nothing back. Using Google map tile colors is certainly creative, but too kludgey for my tastes! – Arian Kulp May 27 '14 at 16:21