Avoid Areas not working in Routing V8 REST API - here-api

Couldn't find a solution so here it goes. I'm trying to avoid a specific area when asking for routing directions. I've made test with both v7 and v8. The v7 works perfectly and avoids the zone but the v8 doesn't. I entered the same parameters (lat and lon) and is not working, does anyone has this error?
I know is managed differently in the docs but it stills doesn't work for v8 :/
V7 --> avoidareas=19.352167,-99.196818;19.351126,-99.194004
V8 --> avoid[areas]=bbox:19.352167,-99.196818,19.351126,-99.194004
What I'm using in postman
I'm looking for coordinates in Latin America, I don't know if the are some location limits in V8 :/ It works in v7 though
Thank you

To anyone that might be lost, the solution is that throughout the API the coordinates are handled latitude first and then longitude (this applies to both origin and destination)
origin = (latitude) , (longitude)
destination = (latitude), (longitude)
However for avoiding areas is the other way around.
If you were to map the box like the south west corner and the north east corner it would be something like this:
avoid[areas] = (longitude sw),(latitude sw),(longitude ne),(latitude ne)
My error was that I didn't look at the API reference with detail and assumed that there was a standard on handling coordinates. My bad :(

Below V8 routing request is working which contains all parameters(including avoid[areas]) and values provided in screen print:
https://router.hereapi.com/v8/routes?destination=19.350952,-99.193858&origin=19.352458,-99.197319&transportMode=pedestrian&avoid[areas]=bbox:13.082,52.416,13.628,52.626&apikey=API_KEY&return=polyline,actions,instructions
Could you please check and revert.

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.

HERE Routing issues with TRUCK setting

We are building mobile application for truck navigation. When using HERE SDK route calculation for trucks, it sometimes tries to avoid a particular road segment, that is in reality suitable for trucks.
One example - highway crossing:
When I calculate route for car, route is correct and meaningful, it follows the highway from south to the north and crosses under the east-western highway. We expect the same route also for a truck as trucks drive like this daily basis (legally).
But when we actually calculate route for truck, it makes a massive detour and takes us either to the westbound highway (blue route on the picture) or eastbound highway, where it turns back after several kilometers and comes back (green route on the picture), both of which is a nonsense. It seems as HERE wants to avoid going under the highway bridge.
I tried to put a waypoint slightly north of the east-western highway and suddenly even with truck setting the route is calculated correctly and does no longer want to avoid going under the bridge. So it seems HERE knows it is legal to go there, but tries to avoid this particular road segment at all costs. We witnessed such behavior multiple times at different places.
This is the exact setup:
Start: 49.154356, 16.600705
Destination: 49.190870, 16.594660
Traffic is disabled for route calculation
For tta time we use getTtaExcludingTraffic()
Truck dimensions were tested both with zero size and and with very small values, so that it certainly fits under the bridge
Question is what causes this behavior? It is a problem of HERE's data? Can we avoid such detours in our application?
Seems like this is more so data error, please use
Map creator (locate the poi and make the change, Here team will review and approve it)
Use Map Feedback API : https://developer.here.com/documentation/examples/rest/map_feedback/no-trucks-allowed-on-road

Matrix routing with destinations close to motorways

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.

Handle traffic in 2D city builder

I´m creating a 2D isometric city building simulation and today I have kind of a "best practice" question without asking for specific code.
As in all city building games you are able to place building, roads and so on. The player is able to place building everywhere, no matter if it´s connected to a road or not. In addition to that there is one building (call it center building) all the buildings need to be connected with (by road).
I need to handle that without doing too many calculations which, breaks the FPS.
Right now I have a timer job for each building which checks if one of the surrounded tiles of a building is a road. That works fine, also for a lot of buildings since the check is simple.
But now I would like to check the connection to the center building. To check that it is necessary (in my opinion) to use something like a pathfinder, which checks if one of the surrounded tiles has a road connection to one of the surrounded tiles of the center building.
I can not check that frequently because this completely smashes the FPS down to 30 or lower. My idea was to fire an event if a road has been built or destroyed to "recalulate" the road connection. But there comes another problem...the player might destoy a road in the middle of the map and the buildings are really far away from each other so I need to find the involved buildings which also might take too much time.
My last idea is creating something like a timer queue and work through these items gradually, but before I keep using the trial and error method I would like to ask you for ideas.
Really looking forward to your ideas!
Yheeky
You could have each building store a list of tiles (a path) that connects it to the center building. Then when a tile is randomly destroyed by the player, you can have each building tested to see if it pathed through that road tile or not.
Alternatively you could have each road tile store which buildings require it, so when the tile is destroyed you have the buildings immediately throw flags. This could get quite messy though, but lends itself decently to background speed cleanup calls.
Both methods are quite messy. Perhaps you can make it a rule that the player can't place roads except next to other roads or next to the center building. Then when the player deletes a road tile, do a paint-style fill that destroys all of the disconnected roads. You can also periodically do a random check on tiles to see if they are illegally placed or not, but that should be unnecessary if you're careful.

Altitude in a tunnel or on a bridge

In my web application, I need to know the altitude of a road. For that, I use the Google Maps API v3. I use the Direction Service for getting the waypoints and then I use the Elevation Service to get the altitude of each points that the Direction Service has returned.
The problem is, if there's a tunnel or a bridge, the elevation will returns the altitude of the mountain (for a tunnel) or under the bridge...
Is there any way to get the good altitude of the road who goes inside a tunnel or on a bridge ?
I'm open for any suggestion.
Thank you
The data you need could be found in Map Maker Road Attributes (is maintained by the community)
Unfortunately there is no API for it on V3
The "good altitude" only can be obtained with a good GPS or another hardware designed for that. A good enough value could be calculated if you somehow store the places where tall bridges are (or deep tunels), and then for those places retrieve the corrected altitude (not an easy task, but if your scope isn't too big and the data is already on Google's Map Marker it could work).

Resources