Detect if point in Latitude/Longitude based Polygon

霸气de小男生 提交于 2019-11-30 15:16:11
bmm6o

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.

I putzed around on the internet for a bit and found this link.

The example is written in C, but looks like it could very easily be adapted to work with C# and Long/Lat coordinates. You would need to keep in mind the crossover lines though (NS/EW), and add code to compensate where necessary, either that or make a decimal conversion of the LatLong values before running the function (West and South are represented with values < 0).

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