在KML多边形中指向-C/C ++代码 [英] Point in KML Polygon - C / C++ code
问题描述
我正在寻找C或C ++代码来识别点(坐标)是否位于KML多边形内.
I am looking for C or C++ code to identify whether the point (a co-ordinate) lies inside a KML polygon or not.
我已经搜索过,但是我所得到的只是可以实现相同效果的javascript(谷歌地图api).我什至不能直接移植它,因为我有一个稍微修改的要求:
I have searched but all I got is javascript (google maps apis) which can achieve the same. I cannot even port it directly because I have a slight modified requirement:
- 确定给定的坐标是否位于KML的多边形内(代码也应排除多边形中的孔!).
- 如果该点在范围之外,则通知呼叫者到最近的多边形边缘的距离.
据我研究,第二点还没有实现.我想知道如何在C或C ++中实现这一目标吗?还是我错过了搜索任何现有资源的机会?
As far as I have researched, the 2nd point has not been achieved anywhere yet. I would want to know how to achieve this in C or C++? Or, have I missed searching any existing sources?
想要输入.
推荐答案
扩展了开源libkml C ++库,并在其中实现了多边形.这是源代码:
Extended the opensource libkml C++ library and implemented point in polygon in it. This is the source code:
https://github.com/gumdal/libkml-pointinpolygon
我要在上面的问题中达到第二点.尽管如此,任何线索都将不胜感激:)
I am yet to achieve the 2nd point in my question above. Any leads in that matter would be appreciated though :)
这篇关于在KML多边形中指向-C/C ++代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!