Search code examples
here-api

HERE API: Routing with certain waypoints seems far off the mark. Why?


I'm new to this forum and not a professional coder by any stretch of the imagination - first post. I'm using the HERE API to calculate drive times and distances for academic research. I have a "Fremium, XYZ" account.

I'm not certain if comparing to Google Maps is a relevant check on accuracy, but for certain waypoint pairs, I find that the HERE API returns results that are close to Google's and others that are way off. Is there a way I can modify the specificity of my routefinding query to improve accuracy? Here are two examples from very low traffic (rural) areas:

Inconsistent with Google

    https://route.ls.hereapi.com/routing/7.2/calculateroute.json?
        waypoint0=47.136242%2C-68.95922&waypoint1=46.675087%2C-67.998587&
        mode=fastest%3Bcar%3Btraffic%3Aenabled&departure=now&apiKey=******

HERE API Distance: 98.8 miles
HERE API Drive Time: 157 min

Google Distance: 77.5 miles
Google Drive Time: 96 min

Consistent with Google

    https://route.ls.hereapi.com/routing/7.2/calculateroute.json?
        waypoint0=46.675087%2C-68.14522&waypoint1=46.675087%2C-67.998587&        
        mode=fastest%3Bcar%3Btraffic%3Aenabled&departure=now&apiKey=******

HERE API Distance: 13.6 miles
HERE API Drive Time: 25 min

Google Distance: 13.3 miles
Google Drive Time: 25 min

Here's what's happening: In the "inconsistent" example, HERE API's route first heads 15 miles in the wrong direction, then turns around, backtracks the entire distance to the starting point, then proceeds along the correct route (the one that Google or any sane driver would choose). I have no idea why it's doing this. I've toyed with setting dirtroad to -3, modifying the mode (fastest;balanced;shortest), but nothing seems to stop HERE API from mis-navigating. Does anyone know what I should do?

Many thanks,

Dan


Solution

  • In order to make your request more accurate please try to add the following parameters in your request as below-

    &maneuverattributes=position,link &linkattributes=shape,DynamicSpeedInfo

    https://route.ls.hereapi.com/routing/7.2/getroute.xml
    ?apiKey={YOUR_API_KEY}
    &routeId=<YOUR_ROUTE_ID>
    &mode=fastest;car
    &maneuverattributes=position,link
    &linkattributes=shape,DynamicSpeedInfo
    &requestid=<YOUR_TRACKING_ID>