如果检测点的纬度/经度基于多边形 [英] Detect if point in Latitude/Longitude based Polygon

查看:149
本文介绍了如果检测点的纬度/经度基于多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检测,在服务器端只能使用C#,基于坐标纬度/经度是否是一个区域(多边形)内由纬度/经度基础点。我认为正确的方式做,这是光线投射,但也许已经有一个C#实现在那里,因为它是不平凡?

I'd like to detect, on the server side using C# only, whether a Latitude/Longitude based coordinate is within an area (polygon) made up of Latitude/Longitude based points. I believe the right way to do this is raycasting, but maybe there is already a C# implementation out there as it's not trivial?

另外,据我所知,SQL Server具有一定几何形状的功能,如 STIntersects 但为了使用,我需要在SQL Server 2008中运行,每个检查将涉及数据库连接,也就是不希望的。

Also, I understand that SQL Server has some geometry function such as STIntersects but in order to use that I need both SQL Server 2008 running and every check would involve a database connection which is undesirable.

推荐答案

由于球体是一个本地微分同胚于平面,您可以使用坐标平面,如该作品的任何算法<一href="http://stackoverflow.com/questions/5223909/determine-if-a-given-point-is-inside-the-polygon">this SO质疑。你只需要做的工作,翻译协调,如果你的多边形包含一个极点。根据你的使用情况,也许你可以拒绝那些投入。

Since a sphere is a locally diffeomorphic to the plane, you can use any algorithm that works on the cartesian plane, e.g. this SO question. You'll only have to do work translating coordinates if your polygon includes a pole. Depending on your use case, maybe you can reject those inputs.

这篇关于如果检测点的纬度/经度基于多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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