简体   繁体   English

如何在Google地图上找到某个点和一条线之间的最近坐标?

[英]How to find the nearest coordinate between a certain point and a line on Google Maps?

This question is specifically for Android, but I understand JavaScript as well. 这个问题专门针对Android,但我也了解JavaScript。
In the image below, A,B and C are known Google Maps coordinates. 在下图中,A,B和C是已知的Google Maps坐标。
I need to find out the coordinate of point X. 我需要找出X点的坐标。
The coordinate of point X is the place where the line between A and B is closest to point C. X点的坐标是A和B之间的线最接近C点的位置。

Is there a way to find X? 有没有办法找到X?

在此处输入图片说明

Use 'google.maps.geometry.poly.isLocationOnEdge()' to find out if X is close or on a polyline or polygon. 使用“ google.maps.geometry.poly.isLocationOnEdge()”来确定X是封闭的还是在折线或多边形上。
Pass the C coordinate, AB points as polyline and a tolerance value - which sets the maximum distance from the polyline is X. It returns true or false. 传递C坐标,将AB点指定为多段线,并指定一个公差值-设置距该多段线的最大距离为X。返回true或false。
The actual coordinate of X is not found, but this is what I was actually looking for. 找不到X的实际坐标,但这就是我真正想要的。

https://developers.google.com/maps/documentation/javascript/geometry https://developers.google.com/maps/documentation/javascript/geometry

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM