Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
274 views
in Technique[技术] by (71.8m points)

router.calculateRoute error returned with no message

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);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...