2
私は以下のコードを使用しています。私はちょうど最適化されたルートと総運転時間の距離を計算したいと思う。誰でも私にこれを手伝うことができますか?mapquestの距離と継続時間の計算
<script type="text/javascript">
// download the module
var map = new MQA.TileMap(document.getElementById('map'));
MQA.withModule('new-route', function() {
// uses the MQA.TileMap.addRoute function to pass in an array
// of locations as part of the request parameter
var opt = {
request: {
locations: ['Gunnison, CO', 'Ouray, CO'],
options: {
avoids: [],
avoidTimedConditions: false,
doReverseGeocode: true,
shapeFormat: 'raw',
generalize: 0,
routeType: 'fastest',
timeType: 1,
locale: 'en_US',
unit: 'm',
enhancedNarrative: false,
drivingStyle: 2,
highwayEfficiency: 21.0
}
},
display: {
color: '#800000',
borderWidth: 10
},
// on success, display the route narrative
success: function displayNarrative(data) {
if (data.route) {
var legs = data.route.legs,
html = '',
i = 0,
j = 0,
trek,
maneuver;
html += '<table class="clean"><tbody>';
for (; i < legs.length; i++) {
for (j = 0; j < legs[i].maneuvers.length; j++) {
maneuver = legs[i].maneuvers[j];
html += '<tr>';
html += '<td>';
if (maneuver.iconUrl) {
html += '<img src="' + maneuver.iconUrl + '" />';
}
for (k = 0; k < maneuver.signs.length; k++) {
var sign = maneuver.signs[k];
if (sign && sign.url) {
html += '<img src="' + sign.url + '" />';
}
}
html += '</td><td>' + maneuver.narrative + '</td>';
html += '</tr>';
}
}
html += '</tbody></table>';
document.getElementById('route-results').innerHTML = html;
}
}
}
map.addRoute(opt);
});
</script>
フォーマットされたブロックからフォーマットコードが失われました。 –