我无法将地址1和2的坐标放在waypoint0和waypoint1
//address1 and address2 with the same method:
var geocodingParams = {
searchText: 'address1'
};
var onResult = function (result) {
var locations = result.Response.View[0].Result,
position,
marker;
for (i = 0; i < locations.length; i++) {
position = {
lat: locations[i].Location.DisplayPosition.Latitude,
lng: locations[i].Location.DisplayPosition.Longitude
};
marker = new H.map.Marker(position);
map.addObject(marker);
}
};
路线:
function calculateRouteFromAtoB (platform) {
var router = platform.getRoutingService(),
routeRequestParams = {
mode: 'fastest;truck',
representation: 'display',
routeattributes : 'waypoints,summary,shape,legs',
maneuverattributes: 'direction,action',
waypoint0: 'coords_address1' ,
waypoint1: 'coords_address2'
};
router.calculateRoute(routeRequestParams,onSuccess,onError );
}