找到最接近地理坐标的地块质量 [英] Find land mass nearest to a geo coordinate

查看:83
本文介绍了找到最接近地理坐标的地块质量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为开发者挑战的一部分,我试图确定最接近给定坐标的地块。显然,如果点在陆地上,我使用反向地理编码并可以获得详细信息。问题是,如果问题在于水体,特别是海洋,它通常不会返回任何东西(谷歌,诺基亚,必应)。我想知道,离加利福尼亚海岸3英里外的一点距离美国3英里,距离日本x英里,距离韩国y英里,当一个点合理地接近一个以上的国家时。是否有任何服务提供这些信息? 使用全球缅因州
  • 简化为最少数量的粗糙多边形。

  • 请带上您的位置, 多边形?


    • 如果您的位置位于一个多边形中,那么它位于海上,通过遍历内部和外部边界上的点来找到最近的一个点, a href =https://en.wikipedia.org/wiki/Haversine_formula =nofollow noreferrer> Haversine Formula 。这将是陆地上最近的点。

    • 如果您的位置不在多边形中,那么您已经在陆地上,请执行直接反向地理编码。




  • 试想一下,这个世界有点像是从游戏外交委员会那里获得的。



    现在将海域合并为更大的多边形与岛屿的孔。
    如果你不在海上,你必须在土地上吗?

    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?

    解决方案

    • 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?

    这篇关于找到最接近地理坐标的地块质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆