[英]Google Maps get LatLng on polyline
I'm trying to get a marker (LatLon object) for a specific distance on top of a polyline on a Google Map. 我正在尝试在Google地图上的折线上方获取特定距离的标记(LatLon对象)。
Using the GetPointAtDistance
function of epolys.js
, I'm getting a point on the map that seems correct, but it is a little "off" the Polyline that the map generated. 使用
epolys.js
的GetPointAtDistance
函数,我在地图上得到了一个看似正确的点,但是它稍微偏离了地图生成的折线。
Here is an example I put together to demonstrate my issue: http://jsfiddle.net/S7VPz/2/ 这是我汇总来说明我的问题的示例: http : //jsfiddle.net/S7VPz/2/
Preferably, I would also like to use a geodesic polyline instead of a straight one. 优选地,我也想使用测地线而不是直线。
对于此特定的折线(两点之间的测地线), google.maps.geometry.spherical.interpolate()
似乎很完美: http : //jsfiddle.net/doktormolle/2nAgr/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.