Is it possible to put a marker after some “km” from the start point in a DirectionsService's route?

对着背影说爱祢 提交于 2020-01-17 14:47:49

问题


This is my code :

var request = {
    origin: start,
    destination: end,
    travelMode: google.maps.DirectionsTravelMode.DRIVING
};

directionsService.route(request, function (response, status) {
    if (status == google.maps.DirectionsStatus.OK) {
        directionsDisplay.setDirections(response);
    }
});

now, I'd like to put a marker after 200km from the point origin: start : is it possible?


回答1:


Here is an example that puts two markers on a route (one at 9.5km and one at 64.8km):

http://www.geocodezip.com/v3_GoogleEx_directions-waypoints_kmmarkersC.html

(so, yes, it is possible)

This example was created before the geometry library was released, and might be able to be re-written to use that.



来源:https://stackoverflow.com/questions/12692824/is-it-possible-to-put-a-marker-after-some-km-from-the-start-point-in-a-directi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!