简体   繁体   中英

How can I add an icon to google maps waypoints?

I am developing a google maps application. I added waypoints but I want to give a different icon. (instead of white circles)

here is my request code:

在此处输入图像描述

return {

          location: {
            lat: parseFloat(element.per_add_lat),
            lng: parseFloat(element.per_add_long),
          },
          stopover: element.personel_id != -1 ? true : false,
        };

    var request = {
      origin: start,
      destination: end,
      optimizeWaypoints: true,
      avoidHighways: false,
      unitSystem: google.maps.UnitSystem.METRIC,
      travelMode: "DRIVING",
      waypoints: waypoints,
    };
    console.log("waypoint", request);

If you use DirectionsRenderer class to render your route, you can define markerOption parameter which will change all the icons. If you want to have a different icon on every waypoint lookhere - but overall you will have to create markers separately

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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