Here Maps 'segmentRef' attribute explanation - here-api

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.

Related

Here maps Getting attractions / places aling route

I am using the Routing service to get the route between two points. I would like to return attractions or places along or near the route, if possible. I have searched but unable to find anything that looks like it does what I need.
You can use the browse end point for the same. This endpoint provides search results for places based on different filters, such as categories or name, ranked by distance from a given search center. The only mandatory elements exposed in the response are id and position. The other elements shown in the response samples section are only dataset attributes suggestions.
https://browse.search.hereapi.com/v1/browse
For more details please check below doc. https://developer.here.com/documentation/geocoding-search-api/dev_guide/index.html

HERE API - Need to get the coordinates of all route waypoints

I need to get the coordinates of all route points through the CURL - in the HERE API documentation, I did not click on how to do it. Tell me what you need to create a request or give a link to the HERE documentation
With HERE Routing v8 API, you can get the route shape by specifying return=polyline in the query parameters, as shown in this guide.
Keep in mind however, that this returns a so-called "flexible polyline", which is an encoded representation of the route shape coordinates. It looks like this:
"polyline": "BGwynmkDu39wZvBtFAA3InfAAvHrdAAvHvbAAoGzF0FnGoGvHsOvRAA8L3NAAkSnVAAoGjIsEzFAAgFvHkDrJAAwHrJoVvb0ezoBAAjInVAA3N_iBAAzJ_Z"
You can use a decoder to get the coordinates. Here is a JS implementation of the decoder. The heremaps/flexible-polyline contains implementations in several other languages.

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.

Obtaining LinkIdType for calculateroute

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

Google Directions API (Transit mode) returns only one alternative route per request

I have built an small application which calls the Google Directions API in Transit mode. It works - nevertheless it returns only one possible route, so it shows no alternatives. Usually I expect 3-4 options to choose from.
Example:
http://maps.googleapis.com/maps/api/directions/json?origin=bieberstrasse,+dusseldorf&destination=norf,+neuss&sensor=false&mode=transit&departure_time=1399399424
The returned JSON structure has the expected "routes" array, but this array always has only one element. I have tried it with addresses in Brazil and Germany - it doesn't matter the country, I only get one single route.
Did I miss some parameter? Could someone help me with it?
If you want alternative routes, specify the request parameter alternatives=true:
http://maps.googleapis.com/maps/api/directions/json?alternatives=true&origin=bieberstrasse,+dusseldorf&destination=norf,+neuss&sensor=false&mode=transit&departure_time=1399399424

Resources