I receive the following error from the code segment below, probably something simple/stupid:
null: Error
at oq.b (eval at (https://js.api.here.com/v3/3.1/mapsjs-core.js:71:36),
:53:389)
at eval (eval at (https://js.api.here.com/v3/3.1/mapsjs-core.js:71:36),
:3:390) {stack: 'Error
at oq.b (eval at (https…3.1/mapsjs-core.js:71:36), :3:390)'}
Code:
// Assumption: the platform is instantiated
let router = platform.getRoutingService(null, 8);
router.calculateRoute({
'origin': '41.76668393192294, -8.582915983435543',
'destination': '42.881834859129576, - 8.544426999819482',
// defines multiple waypoints
//'via': new H.service.Url.MultiValueQueryParameter(['42.0508091768369, -8.646934260389814', '42.243369101867835, -8.720963383232158','42.73879116638964, -8.6606535650917']),
// returns route shape as a polyline in response
'return': 'polyline',
'transportMode': 'pedestrian'
}, (result) => {
const sections = result.routes[0].sections;
const lineStrings = [];
sections.forEach((section) => {
// convert Flexible Polyline encoded string to geometry
lineStrings.push(H.geo.LineString.fromFlexiblePolyline(section.polyline));
});
const multiLineString = new H.geo.MultiLineString(lineStrings);
const bounds = multiLineString.getBoundingBox();
// render route on the map
map.addObject(new H.map.Polyline(multiLineString, { style: { lineWidth: 5 } }));
// zoom to polyline
map.getViewModel().setLookAtData({ bounds });
}, console.error);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…