-1

I want to change the default marker icons A, B and waypoint icons (reference image attached below).

enter image description here

Also this markers can be draggable. If i drag those markers, it should placed on the road except sea, rivers etc. I tried so many ways in last week. I didn't find any solution last one week.

Sathya
  • 1,704
  • 3
  • 36
  • 58

1 Answers1

0

You can remove the marker with this :

directionsDisplay.setOptions( { suppressMarkers: true } );

As you have the direction param "destination" you know where you're going, so you're then totally fine to add another one by yourself :

var latlngDestination = new google.maps.LatLng(???,???) ;
var markerDestination = new google.maps.Marker({
            map: map,
            position: latlngDestination,
            draggable: true,
            icon: 'http://www.google.com/mapfiles/markerA.png'
    });

    directionsService.route({
        origin: ???,
        destination: latlngDestination ,
        travelMode: 'DRIVING'
    }

For the snapping part you have the same question and solution here : Snap to nearest street

Pierre Granger
  • 1,993
  • 2
  • 15
  • 21