Reputation: 11
I want to avoid specific streets when using the routing API. I have data points to create a geofence or polygon to represent those specific streets. The router API accepts only up to 20 bounding boxes. I tried to send 20 avoid area bounding boxes to represent the road, but the result is not reliable (e.g. on diagonal roads).
Is there a way to send a geofence/polygon instead of bounding boxes? Or any other way to avoid certain streets? Thank you very much
Upvotes: 0
Views: 583
Reputation: 21
HERE Routing API now supports polygons for avoid area, https://www.here.com/learn/blog/routing-supports-polygons-for-avoid-areas
Upvotes: 1
Reputation:
You have to make below calls for your usecase.
1>Rest call to get segmentId For the route.
https://router.hereapi.com/v8/routes? apikey={your_app_id}& origin=32.834496,74.81515& destination=32.811632,75.816037& return=polyline,summary,actions,instructions& spans=segmentId& transportMode=car&
2>Rest Call to get the get Route with avoid[segments]
https://router.hereapi.com/v8/routes? apikey={your_app_id}& origin=32.834496,74.81515& destination=32.811632,74.816037& return=polyline,summary,actions,instructions& spans=segmentId& transportMode=car& avoid[segments]=here:cm:segment:808368834,here:cm:segment:808095972
Upvotes: 0
Reputation: 11
Please try to use avoid[segments]
instead of avoid[areas]
for avoiding specific roads. In the case of having too many roads to avoid, you can also put the avoid[segments]
parameters into request body and send a POST
request to the same endpoint.
In order to get the segmentId
of the roads you would like to avoid, you can do a normal routing call with parameter spans=segmentId
added and then look at the topologySegmentId
attributes in spans
section of the response.
https://developer.here.com/documentation/routing-api/api-reference-swagger.html
Upvotes: 1