Get Polyline with the Here Tour Planning API - here-api

We're using the Tour Planning API because it seems to be the only routing API that supports time windows, however according to the documentation the Tour Planning API does not return the route polyline.
Is there another way to get the route polyline along with the ordered stops?

Here Tour Planning and HERE routing are based on the same data; therefore, the tours returned are realistic. In the tour results, the sequence of stops also includes breaks if there are. While requesting the routes from routing API, use all the stops as waypoints (via) with duration at that stop (stopDuration). The resulting route should closely match the tour plan. Depending on the current traffic situation or other factors, there can be a minor difference.
Learn more about waypoint routing here: https://developer.here.com/documentation/routing-api/dev_guide/topics/waypoint.html
An example of routing request with waypoints and stopDuration looks like this: https://router.hereapi.com/v8/routes?routingMode=fast&transportMode=car&return=polyline,summary&departureTime=2022-08-01T08:00:00&origin=52.530914,13.384966;radius=100&via=52.525331,13.369311;radius=100!stopDuration=360&via=52.503011,13.341190;radius=100!stopDuration=1200&destination=52.530914,13.384966;radius=100

Related

HERE Maps - truck restrictions

I'm using the Here API to calculate routes for trucks with 40t. Using the HERE devtools, i got the same error of my APP. The answer is "The API can't calculate the route because of illegal access". I checked the map (image attached) and in the street where my journey will start, with a difference of some meters, it exists two limitations 12t and 18t. The street is one way... If you see the satellite image exists several trucks... The company is testing the software says the trucks goes their...
Can some help me on this?
https://fleet.api.here.com/2/calculateroute.json?waypoint0=41.325299,2.141551&waypoint1=stopOver,3600!41.3291843,2.0317197&waypoint2=stopOver,3600!40.91260530,-8.42291420&waypoint3=38.855951,-9.104382&mode=fastest;truck;traffic:enabled&departure=2020-08-19T02:57:58&alternatives=0&weightPerAxle=14t&limitedWeight=40t&height=4m&width=2.55m&length=16.5m&trailersCount=
If you want to ignore the restrictions for trucks in the route, add the parameter truckRestrictionPenalty and set the value to soft.
The route violating truck restrictions is indicated in the response with dedicated route and manoeuvre notes. The route with the note of the type violation and the text truckRestriction may be travelled at your own responsibility. While driving on such a route, extra care has to be taken as it may result in a vehicle or road infrastructure damage.
You can read more about the parameter here.
Thanks for your feedback, but we are using the Fleet Telematics Api not the Routing API. Using your info, We researched a litle more and we found the equivalent parameter: ignoreWaypointVehicleRestriction.
We added these params &ignoreWaypointVehicleRestriction=5000;0;all and the API returned the route with the warning.
Thanks,

About routing between multiple locations with truck

I have the following content in the link (https://www.developer.here.com/documentation/android-premium/dev_guide/topics/routing.html):
You can use RouteWaypoint to add more waypoint details to your route calculations. These details include whether the waypoint is a deliberate stopover or a crossing point through which the route must pass. This affects routing because the path containing the stopover or route may be different. For example, the calculated route may suggest a U-turn maneuver after a stopover, while a route containing the same location as the waypoint is recommended to continue on the same street. The via waypoint type is only supported in car routes and is not supported in other route types.
I guess this passage means that your company's SDK supports path planning between multiple points, but it seems to only support the "car" type. I want to confirm if the truck type is supported.
Adding multiple waypoints for Trucks is supported, but waypoints will always be of type "Stop_Over" , you cannot have a waypoint as type "Via_point" when using Truck Routing. More details can be found in https://www.developer.here.com/documentation/android-premium/api_reference_java/com/here/android/mpa/routing/RouteWaypoint.Type.html
VIA_WAYPOINT
public static final RouteWaypoint.Type VIA_WAYPOINT
No maneuver is generated for a VIA waypoint. After the VIA waypoint, route will continue in the same direction as when it's approached.
Via waypoints will "force" the route to pass through them, but they will not cause any guidance, announcement or maneuvers.
VIA waypoints are not considered during Guidance triggered re-routing nor do they trigger any callbacks upon arrival at the waypoint.
This is only supported by RouteOptions.TransportMode.CAR . It's ignored for other transport modes.

Deeplinking complex route in Here WeGo

For our use case, we need a turn-by-turn navigation on a mobile device but using a custom route.
Please let me know if the following usage scenario is possible:
Given an array of points (lat/long) that the route needs to pass through, get a route using CalculateRoute.
Create a deeplink for HERE WeGo (e.g. iOS) using the sequence of waypoints obtained in step #1
Navigate turn by turn in HERE WeGo along the route
So far I was successful in #1 but could not create a deeplink with the same route for HERE WeGo. When I create a link, the app simplifies the route to only include origin and destination points and omits all "via" points.
Would appreciate advice on this.
In general passing the waypoints one after the other should open the route with the intermediate points (at least on wego.here.com) , not so sure if this work out of the box in HERE WE Go https://developer.here.com/documentation/deeplink-web/dev_guide/topics/share-route.html

Here-API - Getroute historical route data

I have searched the questions here and gone through a fair amount of the API. I have not found reference to requesting historic route data. My questions is this; Does the Here api support historical route data. An example request would be that I seek the mileage from point a to point b 365 days ago, when perhaps a key route obstruction existed such as a bridge was out or a road was closed for construction that resulted in more miles during that historic period.
I would like to answer this in two parts
Can a route be calculated for a past date ?
Yes, you can. You need to request a Time Aware Route like below. You can read more about it in the developer site.
`
GET https://route.api.here.com/routing/7.2/calculateroute.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&mode=fastest;car;
&waypoint0=geo!37.743385,-122.422835
&waypoint1=geo!37.743878,-122.423686
&departure=2014-03-12T10:00:00
&routeattributes=sh,bb,g
`
Will the map used for the query depend on the departure date ?
No, Here API always uses the current version of the map available unless you specify explicitly the map version. But you can specify only till previous two releases.
So for your question, you wont be able to get the map data for a past year even using map version. But what you can do, is explicitly avoid the bridge or road newly constructed so that the api doesn't suggest that route. You can do this through Custom Route Extension API like below example.
GET http://cre.api.here.com/2/overlays/upload.json
?map_name=OVERLAYBLOCKROAD
&overlay_spec=[{"op":"override","shape":[[50.10765,8.68774],[50.10914,8.68771]],"layer":"LINK_ATTRIBUTE_FCN","data":{"VEHICLE_TYPES":"0"}}]
&storage=readonly
&app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}

Drag route anywhere using Maps API

I want to write an application that gives me the exact route of a subway.
When you use Google Maps it just connects two stops linearly, but not the actual way.
Is there a way to move a route anywhere on a map without being bound to roads?
If there's any solution (doesn't have to be with the Google Maps API) please let me know.
Edit:
Example
Google shows the train route like the brown line, but the train actually drives the blue line. What I would like to do is get the blue line so that I can get the coordinates of the route and calculate the curves and elevation.
I know that I could add like 50 waypoint and get get a "fake" route with them, but I would like to have it automatic and not done by hand.
To show the transit directions (subway, bus, tram, etc.) Google Maps uses the data provided by transit agencies in the form of GTFS feeds. This is a responsibility of the agency to provide a detailed shape of the route for the transport according to the GTFS specification. You can have a look at GTFS documentation to figure out how does it work:
https://developers.google.com/transit/gtfs/
https://developers.google.com/transit/gtfs/reference/#general_transit_feed_specification_reference
I hope this helps.

Resources