Google Map Directions API更改航点文字

时间:2019-02-25 17:23:20

标签: javascript

我想在自己的航路点中途停留:真中更改默认文本

Default text:
  

-R。 da Granja 4725,00葡萄牙布拉加省

I want to change to:
  

-R。 da Granja 4725,00葡萄牙布拉加市,葡萄牙第20000名:安德烈

function calculateAndDisplayRoute(directionsService, directionsDisplay) {
          var waypts = [];
          var last_waypoint= tam-1; 
          for(var g=1;g<last_waypoint;g++){ 
              waypts.push({
                location: destinos[g].latlgn,
                stopover: true
              });
            }
          var destinofinal= tam-1;  
          directionsService.route({
            avoidHighways: Highways,
            origin: destinos[0].latlgn, 
            destination: destinos[destinofinal].latlgn,
            waypoints: waypts, 
            travelMode: 'DRIVING' 
          }, function(response, status) {
            if (status === 'OK') {
              directionsDisplay.setDirections(response);
            } else {
              window.alert('Directions request failed due to ' + status );
            }
          });
        }

The information i want to add, come from the Object destinos[x].name,destinos[x].id 

0 个答案:

没有答案