PHP 地理定位/数学/GoogleMaps 类?
我一直在使用 Google Maps API v3 并创建了一个地图,它允许我在地图上绘制多个标记,然后将它们连接在一起。然后,我有另一个函数集合,可以让我计算定义点和直线之间的距离(以米为单位)。您可以看到下面的示例:
(请原谅 MS Paint,我不应该将其保存为 gif )
这显然都是在客户端完成的 - 我想知道是否有一个预制类可以让我在服务器端实现这一点(如果可能的话使用 PHP)。 值得注意的是,以米为单位的长度不是来自标记,而是来自任何点的线。
编辑:
我正在寻找能够提供两个点(纬度/经度),我将其称为 X 和 Y,然后我想虚拟地绘制这条线,然后提供另一个点 Z,我想知道它是否在该“虚拟”的 10 米范围内线。
I've been working with Google Maps API v3 and created a map which allows me to plot multiple markers on a map and then join them together. I then have another collection of functions that allow me to calculate the distance between a defined point and a line (in meters). You can see an example of this bellow:
(excuse the MS Paint, I shouldn't have saved it as a gif)
This is all obviously done on client side - I'm wondering if there is a pre-made class that would allow me to achieve this on the server side (using PHP if possible). It is worth noting that the length in meters is NOT from a marker, but the line at any point.
Edit:
I am looking for the ability to provide two points (lat/lng) which I'll call X and Y, I want to then virtually draw this line, then provide another point, Z which I would like to know if its within 10 metres of that "virtual" line.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 GIS 上找到此问题的答案:https:// gis.stackexchange.com/questions/11409/calculate-the-distance- Between-a-point-and-a-virtual-line-of-two-lat-lngs
You can find the answer to this question over at GIS: https://gis.stackexchange.com/questions/11409/calculating-the-distance-between-a-point-and-a-virtual-line-of-two-lat-lngs