我尝试在两个地址之间创建一条路由 1.我的代码:
//address1 and address2 the same methode
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);
}
};
//calculte route
function calculateRouteFromAtoB (platform) {
var router = platform.getRoutingService(),
routeRequestParams = {
mode: 'fastest;truck',
representation: 'display',
routeattributes : 'waypoints,summary,shape,legs',
maneuverattributes: 'direction,action',
waypoint0: 'address1' ,
waypoint1: 'address2'
};
router.calculateRoute(routeRequestParams,onSuccess,onError );
}
2。如何在函数“ calculateRouteFromAtoB”中将“ address1”和“ address2”放在waypoint0和waypoint1中?请帮助