Find land mass nearest to a geo coordinate

末鹿安然 提交于 2019-12-21 22:17:28

问题


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?


回答1:


  • 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

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?




回答2:


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



来源:https://stackoverflow.com/questions/22157421/find-land-mass-nearest-to-a-geo-coordinate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!