Matrix routing with destinations close to motorways - here-api

I have a number of locations between which I want to know the travel time and distance.
The locations have been correctly geocoded. However, the problem I am experiencing is that some of the locations lie between a regular road and a motorway. In fact, they lie closest to the motorway.
In this case, the travel time and distance I receive consider the location to lie on the motorway (the closest road), which leads to an incorrect estimation of the actual travel time and distance.
Given that I cannot manually adapt each geocode to lie closest to the regular road, I need a different solution.
I included 'street!!' in my call as indicated on https://developer.here.com/api-explorer/rest/routing/route-to-location-near-motorway but to no avail.
My call looks like this "https://matrix.route.api.here.com/routing/7.2/calculatematrix.json?start0=x.x,y.y&destination0=street!!x1.x1,y1.y1&mode=fastest;car;traffic:disabled&summaryattributes=traveltime,distance&app_id=...&app_code=...".
Is there another way to avoid that Here puts the destination on the motorway?
Your help would be greatly appreciated. Thank you in advance!
Below you find one example
Geocodes of departure: 51.090995,4.018793
Geocodes of destination: 51.017960,3.694040 (close to E40/A10 in Belgium)
When I use the matrix routing API, I get a distance of 29799 meters and a travel time of 1317 seconds.
My call:
"https://matrix.route.api.here.com/routing/7.2/calculatematrix.json?start0=51.090995,4.018793&destination0=street!!51.017960,3.694040&mode=fastest;car;traffic:disabled&summaryattributes=traveltime,distance&app_id=...&app_code=..."
When I use the routing API to get the directions, I can see that my destination is updated to 51.0187054,3.6935735, which is on the E40/A10. This gives me a distance of 29827 meters and a travel time of 1335 seconds.
I used the call below:
"https://route.api.here.com/routing/7.2/calculateroute.json?app_id=...&app_code=...&waypoint0=51.090995,4.018793&waypoint1=street!!51.017960,3.694040&mode=fastest;car;traffic:disabled"
Given that the distance and travel time differs, I executed my matrix routing API call again with the updated destination geocodes (51.0187054,3.6935735). This provided me with the same distance and travel time as my initial matrix routing request, i.e. 29799 meters and 1317 seconds.
I used this call:
"https://matrix.route.api.here.com/routing/7.2/calculatematrix.json?start0=51.090995,4.018793&destination0=street!!51.0187054,3.6935735&mode=fastest;car;traffic:disabled&summaryattributes=traveltime,distance&app_id=...&app_code=..."
As such, I am sure the destination is on the E40/A10. How can I avoid this?
On a related note, why do the travel time and distance differ between the matrix routing API and the routing API?
When I enter the geocodes in GoogleMaps, I actually get the position I wanted.
As you can see, it is not on the E40. Why can't I get a route to the nearest regular street?

So taking the example you gave, the destination waypoint 51.017960,3.694040 lies very close if not on the E40/A10 itself. See image below:
Moreover, using our reverse geocoder API to get the list of address within 200m radius of the destination waypoint returns only addresses (points) along the E40, 9052 Gent, België with street match level . There is therefore no way for the algorithm to know which nearby street you intend to arrive when the waypoint is many hundreds of metres off. I will suggest to correct your waypoints using our reverse geocoder api to determine which waypoints are way off your intended address.

Related

Isoline - Service area too small

I want to create isolines around point locations (public transport nodes) that indicate the service area that can be reached within max. 1 km of walkable distance (with steps of 200 m). When looking at the output, it seems that many of those service areas are not large enough. There are often pieces of road that should be included in the area (as they are within 1 km distance) but they are not. I included a screenshot of one of the service areas below to illustrate.
I this an issue that can be resolved or not?
Illustration
Many thanks
We have to consider the performance of service when calculating the isoline. For this reason, the Isoline service have constraints on the range value.
Please check the below screenshot related to range object and its maximum value.

Fleet Calculate Route API issues [here-api] - the answered question has disappeared so I am posting this again

I am having 3 issues with the Fleet Calculate Route API:
The below is returning a travel time of -9 seconds for one of the legs:
Q: How is it returning a negative time?
https://fleet.ls.hereapi.com/2/calculateroute.json?apiKey={our_api_key}&mode=fastest;car;traffic:disabled&departure=2020-07-21T12:30:00Z&waypoint0=stopOver,840!51.499601,-0.163649;100&waypoint1=stopOver,840!51.499073,-0.165367;100;sort&waypoint2=stopOver,840!51.49811,-0.16591;100;sort&waypoint3=stopOver,840!51.497494,-0.166813;100;sort&waypoint4=stopOver,840!51.495836,-0.168292;100;sort&waypoint5=stopOver,840!51.495834,-0.168292;100;sort&waypoint6=stopOver,840!51.4956530513581,-0.168139304229726;100;sort&waypoint7=stopOver,840!51.497974,-0.163668;100;sort&waypoint8=stopOver,840!51.496995,-0.164536;100;sort&waypoint9=stopOver,840!51.493948,-0.160271;100&waypoint10=51.493948,-0.160271;100
The below is the same parameters as the above except for the sorting. The legs in the above have a different travel time than the same legs in the below (the waypoints are in the same order):
Q: Why are the travel times of the same legs returning different values?
https://fleet.ls.hereapi.com/2/calculateroute.json?apiKey={our_api_key}&mode=fastest;car;traffic:disabled&departure=2020-07-21T12:30:00Z&waypoint0=stopOver,840!51.499601,-0.163649;100&waypoint1=stopOver,840!51.499073,-0.165367;100&waypoint2=stopOver,840!51.49811,-0.16591;100&waypoint3=stopOver,840!51.497494,-0.166813;100&waypoint4=stopOver,840!51.495836,-0.168292;100&waypoint5=stopOver,840!51.495834,-0.168292;100&waypoint6=stopOver,840!51.4956530513581,-0.168139304229726;100&waypoint7=stopOver,840!51.497974,-0.163668;100&waypoint8=stopOver,840!51.496995,-0.164536;100&waypoint9=stopOver,840!51.493948,-0.160271;100&waypoint10=51.493948,-0.160271;100
In general, the total travel time of a leg is different from the summation of its corresponding maneuver travel times.
Q: Shouldn't the total leg travel time be equal to the summation of the maneuver travel times?
1. The below is returning a travel time of -9 seconds for one of the legs
Answer: on currently test the negative time is not reproducible any more.
2. The below is the same parameters as the above except for the sorting. The legs in the above have a different travel time than the same legs in the below (the waypoints are in the same order)
Answer: This is correct, please use the example on https://tcs.ext.here.com/examples/v3/fleet_telematics_api to visualization your requests on the map just switch to Export mode and push your URL: on map you can see the green markers that show you navigable start point for each waypoint and you can see the difference between sorted an unsorted waypoints. Why are difference? because in the waypoints you use transit radius 100 and then is selected a navigable link at the edge of the radius 100 meters and then of course sorted.
Recommendation: use please in waypoint parameters without transit radius first and if some waypoint can't reach the navigable link then set some radius for this waypoint.
3. In general, the total travel time of a leg is different from the summation of its corresponding maneuver travel times.
Answer: No, on currently test this differences are not reproducible any more.

metricSystem parameter support in "discover/search"

distance is given in meters for this query:
https://places.cit.api.here.com/places/v1/discover/search?app_id=my-app-id&app_code=my-app-code&at=36.97425,-122.03099&pretty
Is there any plan to support "metricSystem" parameter(as is done in the case of Routing APIs) so that the result can provide distance in miles?
Correct, the distances are just given back in meters from the Places API. There are no further plans to change this in future. But you can easily calculate the values into miles on client side.

Can I pass multiple travel modes when using The Google Maps Distance Matrix API

I need to calculating times and distances with multple travel modes, I try to pass multiple travel modes separated with | like this:
https://maps.googleapis.com/maps/api/distancematrix/json?origins=E149AQ&destinations=UB83PH|NW14SA|WC1E7HU|N78DB&mode=walking|bicycling|driving&language=en-GB&key=myKey
But it doesn't work as I expected.
Only a single travel mode is supported per request. To get results for multiple travel modes, make multiple requests.
The documentation implies that but doesn't state it explicitly:
Optional parameters
mode (defaults to driving) — Specifies the mode of transport to use when calculating distance. Valid values and other request details are specified in the Travel Modes section of this document.
Travel Modes
For the calculation of distances, you may specify the transportation mode to use. By default, distances are calculated for driving directions. The following travel modes are supported:
driving (default) indicates distance calculation using the road network.
walking requests distance calculation for walking via pedestrian paths & sidewalks (where available).
bicycling requests distance calculation for bicycling via bicycle paths & preferred streets (where available).
transit requests distance calculation via public transit routes (where available). This value may only be specified if the request includes an API key or a Google Maps API for Work client ID. If you set the mode to transit you can optionally specify either a departure_time or an arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time). You can also optionally include a transit_mode and/or a transit_routing_preference.
Note: Both walking and bicycling directions may sometimes not include clear pedestrian or bicycling paths, so these directions will return warnings in the returned result which you must display to the user.

Weighting output of cost function based on user input

Hi I am creating an android app that will generate a cycling route for users using a route finder.
I am trying to allow the user to either prefer distance or routes with cyclelanes present.
I have a slider from 0 to 10, where 0 means the user wants the shortest route, and 10 where the user wants roads with cyclelanes (if available).
The roads are represented as a graph and I have a function that calculate the shortest path from one point to another.
Given the output of this function: if there is a cyclelane present on the road I want to weight the result so that the higher the number the user chose, the lower the cost of the road and vice versa.
I am not really sure how weighted functions work.
if you calculate the route with dijkstra-like algorithm, in case of a cyclelane-edge, you should simply decrease the distance between two point by some value according to the slider-value

Resources