How can I get batch distance to endpoints? - here-api

Can I get batch distance from start point to other points (not sequentially) with a single query?
Starting point - Point 1
Starting point - Point 2
Starting point - Point 3

A location service providing customizable route calculations for a variety of vehicle types as well as pedestrian modes also creates a route from a sequence of tracepoints.
Review the following demo link and use your API key to process batch distance with a single query.
Url: https://demo.routing.ext.here.com/

Related

HereAPI - Can't reach waypoints requested

I am trying to execute a rather simple request using Here FleetApi Demo, this is the request I am trying to do:
https://fleet.api.here.com/2/calculateroute.json?waypoint0=19.3411164,-99.2533428&waypoint1=19.415757,-99.177453&waypoint2=19.344366,-99.251718&mode=fastest;car;traffic:disabled&departure=2021-09-21T11:05:44&alternatives=0&weightPerAxle=0.87t&limitedWeight=1.739t&height=1.67m&width=1.8m&length=4.41m
But this error is returned:
Couldn't reach way point 1 (start links -703403377 703403377 dest links -895284559 895284559 ), closest link to destination reached: 1291258613 at 19.34133/-99.25233, issues: gate
This request has a similar situation on waypoint 2 but this returns the following issue:
Couldn't reach way point 2 (start links 895284559 dest links -832770028 832770028 ), closest link to destination reached: -1077091646 at 19.34552/-99.25272, issues: one way
In both situations, it is possible to travel these routes but Here is unable to calculate it. The only way to do so is by adding a radius to search for the waypoint but that returns wrong routing:
In this example, waypoint blue is the desired waypoint but waypoint green is returned which is not acceptable solution.
Is there a workaround to these issues or am I doing something wrong?
We use Google Maps Directions API to retrieve lat,lon of waypoints.
When you throw the request into demo tool https://tcs.ext.here.com/examples/v3/fleet_telematics_api (expert mode). It will show the error and a red flag at the nearest reached point. Then you see that this is a industrial area or leisure park or similar. The fleet telematics APIs applies various vehicle restrictions and gate restrictions while calculating the route.
If you want to ignore those restrictions you have to set &ignoreWaypointVehicleRestriction=100000 and &traverseGates=true in the request query. Then ,it will ignore the VehicleRestriction and allows the router to traverse all gates.
Sample Request.
https://fleet.api.here.com/2/calculateroute.json?waypoint0=19.3411164,-99.2533428&waypoint1=19.415757,-99.177453&waypoint2=19.344366,-99.251718&mode=fastest;car;traffic:disabled&departure=2021-09-21T11:05:44&alternatives=0&weightPerAxle=0.87t&limitedWeight=1.739t&height=1.67m&width=1.8m&length=4.41m&&ignoreWaypointVehicleRestriction=800000&traverseGates=true
For more details regarding &ignoreWaypointVehicleRestriction=100000 and &traverseGates=true flags ,please refer below API document.
https://developer.here.com/documentation/fleet-telematics/api-reference.html#tag%2FRouting-Extensions-&-Route-Matching%252Fpaths%252F~1v8~1calculateroute.json%252Fget

How to request a navigation with heading?

I would like to use the HERE navigation API so that I arrive at the destination in a certain heading (in degrees from north, for example). This may require a detour to arrive at the destination in the correct direction. Can this be done? How?
EDIT: Also for a regular routing request, I would like to know the heading at the destination.
Please check Fleet Telematics API documentation on how to provide the heading for a waypoint - https://developer.here.com/documentation/fleet-telematics/api-reference.html. The documentation also helps us understand how to retrieve heading information in the response using customattributes parameter.
waypoint0 ... waypointN
required
string
Comma separated waypoint latitude, longitude in WGS-84 degree. A route must consist of at least 2 waypoints (start and destination). The maximum number of waypoints is limited. However, this limit is not a fixed number but is a result of the limit for the overall processing time. Set a transit radius by ;10000 to only influence the route to go via a certain city Set a heading by ;;;140 (degree clockwise from North) to improve map matching To define a loading/delay time at a waypoint, use stopOver[,timeInSeconds]!. Example: &waypoint1=stopOver,300!50.12,8.65. The optional specifications altitude, custom label, !StreetPosition and !LinkPosition are currently supported. The coordinates may be directly followed by ;transitRadius;label;heading. Waypoints can have opening and closing times, can be unsorted or optional. Details are in Key Concepts / Waypoint sorting, optional Pickup and Opening Times

How to show only train/subway stations using nearby stations api?

I am using the nearby stations by geocode transit api to return a json result of 3 closest stations. I assumed these would be train/subway stations but the 3 closest to any given dynamic lat & lng are usually bus stations.
Example of my query with parameters: https://transit.api.here.com/v3/stations/by_geocoord.json?center=LAT%2CLNG&radius=350&app_id=APPID&app_code=APPCODE&max=3`
I have read in pervious posts that the ability to use modes such as mode=1 is only available whilst using one of the routing apis.
To cut down on API calls, I do not wish to call google map nearby places api for train/stations and then use those stations in another api call to Here.com to get the distances. I was hoping there was a way I can do it in one call.
I am client side filtering at the moment and only displaying name & distance. I see that if I change my max parameter to 50, i see more results further down which are tube/subway stations but unsure as to how I would go about filtering these out. Also, i see reference to icons but no url's given to access them, where are these located?
I am using ReactJS and the native fetch method for my api request.
Thanks
I expect that you have 3 requirements:
1) names and distances of stations around a specific coordinate, 2) stations should be filtered by only trains/trams(intercity or intracity) and
doesn't include buses and remaining other modes,3) Avoiding multiple API calls:
by_name or by_geocoord API restrict the search based on the modes, though it can fulfil the first requirement
Route transit API returns connection with the transit stations(by train only) and distances as well, based on the arrival and departure coordinates,
https://transit.api.here.com/v3/route.json?app_id=xxxxxxxxx&app_code=xxxxxxxx&modes=intercity_train,bus,light_rail&dep=41.9773,-87.9019&arr=41.8961,-87.6552&time=2019-06-24T07%3A30%3A00#

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.

Maps API is there a way to get available routes from A to B when they are the same?

So I want to find different walking routes where the start and end destination is the same. So If I as a user choose 5km, maps would show me routes that are about 5km long and start and ends at the same location. I have looked through the (messy) maps apis but haven't managed to find any endpoints for doing this.
You can do something like that by adding waypoints. So for a 5km walk you could generate a random point within 2.5 km of your start/end point and add it as a waypoint when generating directions.
Edit:
In addition you may try using the Geometry library in the Google Maps API. There is a computeOffset function which returns the LatLng resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north). This way you can add some waypoints relative to the start/end point. Or in close proximity to the random first waypoint.
https://developers.google.com/maps/documentation/javascript/directions#Waypoints

Resources