纬度和经度作为多边形算法中适合点的坐标
给定表示目标的长/纬度坐标的数据库以及表示表示“区域”的多边形的边界坐标的一系列纬度/经度。使用简单的射线投射算法将纬度/经度视为笛卡尔坐标来确定目标是否在区域内是否安全?
Given a database of long/lat coordinates representing targets and a series of lat/long representing the bounding coordinates of polygons representing "zones". Using a simple ray casting algorithm is it safe to treat the lat/long as cartesian coordinates for determining if the target is within the zone?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只要边缘短,它就应该工作得足够好。但它不会是“正确的”。
想象一个三角形,其中两个点 a 和 b 位于赤道上,其中一个点位于北极附近。显然,(几乎)所有经度位于赤道上方 a 和 b 之间的点都在三角形中。但是,如果我们尝试将纬度/经度视为笛卡尔坐标,我们会得到完全不同的东西......
编辑:您需要小心跨越经度 = 最大/最小的区域,甚至更小心那些也包含一根杆子
Provided the edges are short, it should work well enough. It won't be "correct" though.
Imagine a triangle with two points a and b on the equator and one just short of the north pole. Evidently, (almost) all points with a longitude between a and b above the equator are in the triangle. But if we try treating the lats/longs as cartesian coordinates, we get something quite different...
Edit: You'll need to be careful with zones which cross longitude = max/min, and even more careful with the ones that also contain a pole
您可以尝试一下
您可以在此处查看演示
You can try this
You can view Demo here
不,这样做并不安全。您会在两极周围以及 0 经度区域发现异常情况。
看看 NASA 的世界风代码。它们有地球表面多边形的表示,尽管你必须小心——有些表示会表示这些异常,有些则不会。
http://worldwind.arc.nasa.gov/java/
No, it's not safe to do that. You'll get anomalies around the poles and also at the 0 longitude areas.
Take a look at the NASA world wind code. they have representations for polygons on the surface of the globe although you have to be careful -- some of the representations will represent these anomalies, others will not.
http://worldwind.arc.nasa.gov/java/