Obtaining LinkIdType for calculateroute - here-api

I'm currently trying to use the the calculateroute endpoint to avoid certain roads that I specify.
It accepts avoidLinks parameter in which a list LinkIdTypes can be specified which determines the network links to be avoided when calculating the route.
What I'm having trouble finding is how do I get those LinkIdTypes, does Here provide an endpoint to query them (specifiying lat & lng)? or perhaps an endpoint I can use to define my own which then gives me a LinkIdType which I can reuse for future calls?
tl;dr: Where do I get LinkIdTypes for a specific road?
Addendum: I am aware of avoidAreas but this seems too cumbersome to use since I have to specify a bounding box instead of a road segment.

you can get linkId by doing a reverse geocode of a lat,lng.
Exemple of reverse geocode .
LinkId is available in the field ReferenceId.
You can also get the list of linkId of your route with calculateroute using legAttributes=links.
Exemple of calculate route

Related

Here Maps 'segmentRef' attribute explanation

Can someone explain/point to documentation that explains the 'segmentRef' attribute that gets returned by the Here Routing API v8 when spans="segmentRef". An example of what gets returned is shown below. The middle part seems to be the topologyID but I can't figure out the rest. Thanks.
$0:321534451:$1:457679505#-0..0.7675126869621484
In v8, segmentRef is returned instead of PVID. spans conceptually replace link attributes.
Please refer the screenshots of supported link attributes.
For more details please refer the below api guide.
https://developer.here.com/documentation/routing-api/migration_guide/index.html
segmentRef is a parameter used in the HERE Maps API to identify a specific segment of a route. The segmentRef parameter is used to reference a specific segment within the route, and can be used in conjunction with the HERE Routing API to retrieve information about that segment. The information that can be retrieved for a segment includes details such as the start and end coordinates, the length of the segment, and the type of road along which the segment is located.
The segmentRef parameter is typically used in conjunction with other parameters, such as origin and destination, to define the overall route and retrieve information about specific segments within that route.

How many way points can I pass in the URL? Can I pass more than 100 way points?

I've been using HERE api to calculate the roughness profiles of the route. I need to pass more than 100 waypoints to get the IRI index. Is it possible to pass n number of waypoints or is there certain limit to it?
We only support GET method, POST will allow more, but it is not (yet) supported currently support whatever URL length limits allow.. So something like 100+ waypoints, but for optimising the route, there is a separate service which solves this is provided below.
https://developer.here.com/documentation/routing-waypoints/dev_guide/topics/quick-start-simple-car.html

Coordinates from Geocoding Autocomplete

We are integrating Here Autocomplete with our current typeahead feature. Currently this Autocomplete endpoint is not returning any coordinates, and to retrieve them, we must make an additional call to the Geocoding endpoint with the location id. Effectively doubling HERE calls for any one address.
Is there any way that the Autocomplete endpoint can include GPS coordinate?
To find the corresponding geocoordinates based on free-form input, send the following GET request.
https://geocoder.api.here.com/6.2/geocode.json?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&searchtext=425+W+Randolph+Chicago
The response to the above request delivers the following high-level elements:
1) Metadata about the request
Results that match the request.
2) The number of results depends on the completeness of the address provided.

Route restrictions of a particular area/city in Here Maps API

Is it possible to get the route restrictions of a particular area/city using here api?
My objective is to visualise the route restrictions of a particular city.
There is a parameter to avoid areas
avoidAreas
and to avoid countries excludeCountries=BOL,PRY,URY which takes a list of ISO 3166-1-alpha-3 country codes.
Please find the source of documentation.
Hope this helps!
Map Tile API can return map tiles with truck restrictions (you need your own apikey in order to see that tile):
https://4.base.maps.ls.hereapi.com/maptile/2.1/trucknopttile/newest/normal.day/10/301/384/512/png8?apikey={YOUR_API_KEY}

How to retreive speed limit from here maps given a latitude and longitude?

I'm trying to get speed limit from Here API maps but I can't find the way to do it. I tryed few example on web site but the only one that works is the one which require point of start and point of stop of the route.
I would like to get the speed limit given only one point ( or a box ). Which api do I have to use? Is there an example?
https://route.cit.api.here.com/routing/7.2/calculateroute.json?jsonAttributes=1&waypoint0=51.31854,9.51183&waypoint1=50.11208,8.68342&departure=2019-01-18T10:33:00&routeattributes=sh,lg&legattributes=li&linkattributes=nl,fc&mode=fastest;car;traffic:enabled&app_code=appcode&app_id=appid
This is the waypoint one but is not what I'm looking for, I would like to pass it only a Latitude / Longitude.
Thank you
You can achieve this by using PDE API(Platform Data Extension)
You have to first map your geocordinates(lat,long) to a navigable position(lat,long) for the given coord and the Functional Class(FC1-5) it is located in. This you can achieve by a simple geocoder request
You can calculate tilexy values based on the navigable lat,long and pass it to PDE API for querying speed limit layer on that particular FC class.
Look at https://tcs.ext.here.com/examples/v3/link_speed_locator example which covers this exact usecase.
Below is a sample geocoder request. Here prox parameter is your lat,long
https://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.json?app_id=xxxx&app_code=yyyy&prox=50.133848, 8.715332,500&mode=retrieveAddresses&maxResults=1&additionaldata=SuppressStreetType,Unnamed&locationattributes=linkInfo
Below is a sample pde request
https://pde.cit.api.here.com/1/tiles.json?layers=SPEED_LIMITS_VAR_FC1,SPEED_LIMITS_VAR_FC2,SPEED_LIMITS_VAR_FC3,SPEED_LIMITS_VAR_FC4,SPEED_LIMITS_VAR_FC5,ROAD_GEOM_FC1,ROAD_GEOM_FC2,ROAD_GEOM_FC3,ROAD_GEOM_FC4,ROAD_GEOM_FC5&levels=9,10,11,12,13,9,10,11,12,13&tilexy=536,398,1073,797,2147,1594,4294,3188,8588,6377,536,398,1073,797,2147,1594,4294,3188,8588,6377&app_id=xxxx&app_code=yyyy
Read more about it in the developer site - https://developer.here.com/documentation/platform-data/topics/quick-start-view-map-data.html
Hope you find this useful!
The ReverseGeocoder has rarely used mode "trackPosition" (mode=trackPosition).
In combination with locationattributes=linkInfo you may retrieve the speed limit for that matching road.

Resources