如何使用PHP或MySQL检查地理编码是否接近或位于KML LineString中定义的路径上 [英] How to check if geocode is close to or on path defined in a KML LineString with PHP or MySQL
问题描述
我有一个KML文件,定义了<LineString><coordinates></coordinates></LineString>
标记中包含的若干路径/路线(代表实际道路).已将文件解析为其他格式(数组/MySQL),所以这不是问题.
I have a KML file defining several paths/routes (representing actual roads) enclosed in the <LineString><coordinates></coordinates></LineString>
tags. Parsing the file to other formats (arrays/MySQL) is already in place, so that's not a problem.
给出一个点(经度/纬度),我希望能够检查该点是否在KML文件中的一条路线上或附近(几米之内).我一直在寻找PHP的解决方案,但一直没找到一个解决方案-而且我不确定,我在寻找什么.但是,在我看来,这确实是一个常见问题,因此我怀疑有人已经解决了该问题.有人知道解决方案吗? ;)
Given a point (longitude/latitude) I would like to be able to check if the point is on or close to (within a few meters) one of the routes in the KML file. I've been looking for a solution in PHP, but I haven't been able to find one - and I'm not really sure, what I'm looking for. This does however seem to me like a common problem, so I suspect someone already solved the problem. Does anybody know of a solution? ;)
提前谢谢!
推荐答案
您需要将其分解为两个问题:
You need to break this down into two problems:
- 从路径的每个部分生成一组多边形.
- 在多边形测试中对上述多边形做一个简单的点.
应该有一些php来完成这两个任务.
There should be some php out there to accomplish those two tasks.
这篇关于如何使用PHP或MySQL检查地理编码是否接近或位于KML LineString中定义的路径上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!