Search code examples
mapshere-apiheremapshere-routing

HERE Maps Route Matching v8 Can't Set Preferred Route


Hi all and thanks in advance,

I am trying to use Route Matching v8 to set a road as a preferred route so that it will try and take that road when possible.

I have followed the documentation guidelines and have tried to do this using the demo suite provided in the documentation. https://demo.support.here.com/examples/v3/custom_routing_basic

I have tried using the code suggested in the documentation and it is not working. Can anyone help me understand why this is?

#1 - Submit Overlay
/2/overlays/upload.json
?map_name=OVERLAYNEWBRIDGE&overlay_spec=[
  { "op":"create",
    "shape":[[50.10953,8.68643],[50.10726,8.68697]],
    "layer": "LINK_ATTRIBUTE_FCN",
    "data":{"NAMES":"ENGBNDemo Road"}
  },
  {"op":"restrict",
   "shape":[[50.10953,8.68643],[50.10726,8.68697]],
   "type":"preferred", 
   "data":{"PREFERRED_ROUTE_TYPE":"201","ENTRY_PENALTY":-1,"DRIVE_PENALTY":-0.1}
  }
]
&app_id=akl066ieG9nLbhXEWANd&app_code=zKCsydHYhOY17rbzvhq4KQ
&storage=readonly

#2 - Display Overlay
/2/search/all.json
?map_name=OVERLAYNEWBRIDGE&geom=full
&layer_id=LINK_ATTRIBUTE_FC1,LINK_ATTRIBUTE_FC2,LINK_ATTRIBUTE_FC3,LINK_ATTRIBUTE_FC4,LINK_ATTRIBUTE_FC5
&acceptMissingLayers=true
&app_id=akl066ieG9nLbhXEWANd&app_code=zKCsydHYhOY17rbzvhq4KQ

#3 - Calculate Route
/2/calculateroute.json
?waypoint0=50.11089,8.68809&waypoint1=50.10703,8.68222
&mode=fastest;car;traffic:disabled&overlays=OVERLAYNEWBRIDGE
&app_id=akl066ieG9nLbhXEWANd&app_code=zKCsydHYhOY17rbzvhq4KQ

#4 - Delete Overlay
/2/maps/delete.json?map_name=OVERLAYNEWBRIDGE
&app_id=akl066ieG9nLbhXEWANd&app_code=zKCsydHYhOY17rbzvhq4KQ
&storage=readonly

Solution

  • I see you make preferred to shortly created shape. It seems doesn't work currently. Development team is already working on it.

    Workaround if set penalty for the standard bridge like:

    #1
    /2/overlays/upload.json
    ?map_name=OVERLAYNEWBRIDGE&overlay_spec=[
    { "op":"create",
    "shape":[[50.10953,8.68643],[50.10726,8.68697]],
    "data":{"NAMES":"ENGBNDemo Road"}
    },
    {"op":"restrict",
    "shape":[[50.109569,8.687733],[50.107257,8.687765]],
    "type":"preferred",
    "data":{"VEHICLE_TYPES":"1023", "PREFERRED_ROUTE_TYPE":"201","ENTRY_PENALTY":10,"DRIVE_PENALTY":0.5}
    }
    ]
    &app_id=akl066ieG9nLbhXEWANd&app_code=zKCsydHYhOY17rbzvhq4KQ
    &storage=readonly