计算方式点顺序不起作用 google 映射 API

Calculate way points order does not function google maps API

我正在使用 google 地图 API 来计算具有 waypoints

的路线

有时路线计算正确但有时不正确

我从 Apex 获取了一些值(这是一个 VisualForce Page Salesforce Javascript)

          var wayptsApresMidi = [];
          var wayPointApresMidi = {!wayPointsLocationOfPCEApresMidi};

          for(var i= 0; i < wayPointApresMidi.length; i++){                 
            wayptsApresMidi.push({
              location: new google.maps.LatLng(wayPointApresMidi[i][1], wayPointApresMidi[i][0]),
              stopover: true
            });
          }

          console.log('firstLocationOfPCELatitudeApresMidi '+'{!firstLocationOfPCELatitudeApresMidi}'); 
          console.log('firstLocationOfPCELongitudeApresMidi '+'{!firstLocationOfPCELongitudeApresMidi}'); 
          console.log('lastLocationOfPCELatitudeApresMidi '+'{!lastLocationOfPCELatitudeApresMidi}'); 
          console.log('lastLocationOfPCELongitudeApresMidi '+'{!lastLocationOfPCELongitudeApresMidi}'); 

          for(var i=0; i<wayptsApresMidi.length; i++){
              console.debug('wayptsApresMidi Longitude and Latitude '+wayptsApresMidi[i].location);
          }

          directionsServiceApresMidi.route({
              origin: new google.maps.LatLng('{!firstLocationOfPCELatitudeApresMidi}', '{!firstLocationOfPCELongitudeApresMidi}'),
              destination: new google.maps.LatLng('{!lastLocationOfPCELatitudeApresMidi}','{!lastLocationOfPCELongitudeApresMidi}'),
              waypoints: wayptsApresMidi,
              optimizeWaypoints: true,
              travelMode: 'DRIVING',
              unitSystem: google.maps.UnitSystem.METRIC,
              language: 'fr'
            }, function(response, status) {
              if (status === 'OK') {
                  console.log(response);

            for (var i = 0; i < response.routes[0].legs.length; i++) 
            {
                console.log(response.routes[0].legs[i].start_address);
                console.log(response.routes[0].legs[i].end_address);
            }
         });  

当不运行时,waypoint_order 的返回值可以是 [4294967295, 4294967295](wayPoints 的数量是正确的,但值为 4294967295)

for (var i = 0; i < response.routes[0].legs.length; i++) 
            {
                console.log(response.routes[0].legs[i].start_address);
                console.log(response.routes[0].legs[i].end_address);
            }

十次

38 Rue Verte, xxxx, France

firstPoint/ WAyPoints/ LastPoint 有一些不错的值

此外,当travelMode为WALKING时,将travelMode DRIVING设置为可以起作用 (反之亦然 -> 当 DRIVING 不起作用时 WALKING 可以起作用)

前几周一直有效 我不知道它是否只是有时因为我的代码更改而起作用,或者 Google 地图 API 是否在过程中修改了某些内容

纬度/经度点后可以有16位数字(有问题吗?)

你有想法吗? 谢谢,

看起来这是一个已知问题。

请查看以下google问题跟踪器。

https://issuetracker.google.com/issues/135627404