HERE Routing API - Matrix/Multiple arrival times? - here-api

Update: I have switched to HERE Routing API because I was told that it would be faster. I am trying to use HerePy to get a routing matrix, but I am getting the following error message:
AttributeError: 'RoutingApi' object has no attribute 'matrix'
Regardless of whether I find out how to move past this error, it's also not clear whether this API could accept multiple departure times (Each of my origins has its own departure time.). I have a feeling I will also run into the matrix size issue again. Does anyone know how to fix this error and/or know more about what I'm able to do? I had a phone call with someone from the sales department, but they didn't know the answers to these questions.
Original Question: I am trying to use the Google Maps Distance Matrix API. I have an array or origins, an array of destinations, and then an array of arrival times. Each destination has its own arrival time. From what I have read in the documentation, it is not clear whether I can use an array of arrival times, or just one arrival time per request. Does anyone know?
I suppose if I can only do one arrival time per request, then I would just group together the destinations with the same arrival times into one request. I will need to do multiple requests anyway due to the 100 maximum of elements/25 maximum of origins or destinations per request.
Thanks!

You can check the Matrix Routing API offered by Here API.
The Matrix Routing service is an HTTP JSON API that calculates routing matrices, travel times and/or distances, of up to 10,000 origins and 10,000 destinations. A routing matrix is a matrix with rows labeled by origins and columns by destinations. Each entry of the matrix is the travel time or distance from the origin to the destination.
For more information , please do visit to the following link

Related

Google Maps Distance Matrix - efficient useage [duplicate]

This question already has answers here:
Google Maps API - Getting closest points to zipcode
(2 answers)
Closed 2 years ago.
I'm working on the delivery web app and can't figure out how can I reduce the number of requests app sends to google distance matrix to calculate a distance between requested delivery and store address.
I have a page-catalogue that has around 1000 stores. Each time user enters delivery address I send 1000 requests to google maps API to check if user's delivery address is within each store delivery range. Hence google charges me for 1000 requests every time users enter new delivery address.
Any suggestions on how to optimise usage of Google API and show only those stores that deliver to the selected address, as the current way is the way too expensive. I'm wondering how large on-demand delivery services that have tens of thousands of stores deal with this?
You could calculate the direct-line distance (using a formula) and only request stores whose direct line distance is less than the allowed range, since the travel distance can't be shorter than the direct line.
If you don't care about getting exactly the shortest travel, you can also sort the candidates, request them in order and stop as soon as you get an acceptable one. That will occasionally give a store that's physically closer but further away by road, which may or may not be acceptable.
In most programming languages, the direct-line distance will be available in a "geo" library or similar, under the name "great-circle distance". You can also search for it here on SO.

Is there a way to retrieve information about a previously calculated route without a routeHandle in HERE Maps Routing API v8?

I have downloaded a bunch of routes from HERE Maps Routing API v8. At the time, I wasn't aware about the routeHandler parameter, so I didn't return it from my requests.
Now I need to acquire duration times with different departure times from these previously downloaded routes. Is there a way I can retrieve/calculate the routeHandler with all other information I have about the route? Or to retrieve the duration times for the routes without a routeHandler? (maybe with the route's id or polyline)
I thought of recalculating the routes, giving the same origin/destination, but I'm afraid the results may differ from my previous routes, since the API may return different routes based on departure time.
I found out that the Routing API v7 has a way to retrieve the route with routeID, but it doesn't work with the id returned by v8.
EDIT: I thought of making a request with the time the original routes were donwloaded as the departure time, in order to get the routeHandler, but I'm not sure the routes returned will be the same as the ones I have, because the departure time was set to 'now', and I don't know if requesting past times returns the same thing as before.
If you didn't specify parameter return=routeHandle in the request then you can't get previously calculated route (or routeHandle) neither by polyline nor route's id(doesn't exist in v8) nor by something else.
You are right, if you recalculate a route then you get different route response because it will be another traffic situation on the roads at departure time.
Caution: when you will decode route by routeHandle (/routes/{routeHandle}) and with different departure times then it will be used anyway always previously encoded route polyline(but of course with another penalties) therefore for some waypoints (origin, destination, via) combinations recalculated route could return more effizient route at particular departure time.

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#

Google Map API Get Duration without traffic

I know that the durationIntraffic is depracated now.
I just cant find a way to get the duration without traffic using google api.
already tried the matrix using DrivingOptions and trafficModel but the duration and duration_in_traffic did not match the duration without traffic in Maps.Google.com
Any help on how to get the duration without traffic data using API?
Image
Duration gives average time and duration in Traffic gives time in traffic .sometimes you run googleApi at midnignt you will find duration in Traffic time is lesser than duration time means duration is not without traffic time.
According to this Google Maps API should return an element called duration as well as an element called duration_in_traffic. Duration will be time without traffic while duration_in_traffic is time with traffic conditions.
Just to set the correct expectations, you shouldn't expect the Web Services API and the Google Maps website to work in the exact same way. These are different products managed by different teams at Google. The search stack is also different, so results may differ.
The result you get in duration field is an approximation of the average travel time for the route. This takes into account average traffic conditions of the last several weeks for a time when you execute a request. That means that the duration can change during the day.
Applying the departure time and traffic_model you can add further information to your requests to get the travel time in the current traffic, this will be provided in a duration_in_traffic field.
Resuming, currently there is no way to get duration without traffic. You will get the average travel time via the API.

R: Google Distance Matrix API request rate limit exceeded

I know that similar questions have been asked before, but from what I've been able to gather, none of the answers seem to apply to my case.
What I'm trying to do is replicate this, but in the R language : Computing the optimal road trip across the us
Everything works perfectly until I ask the Googles for the distance matrix for more than 10 locations. In my script (to follow) I list my API key, and on the API website I can see that my successful runs of the program (when the number of locations is less than 10) increase my usage for the day, so I know that my API is working... I think.
What I don't understand is why do I receive the "rate limit exceeded" error for, say, a distance matrix with 11 locations? If I have 1,500 requests left, I should certainly not have any issues, right? I should add that I am not familiar with other programming languages such as Java and Python, so that could explain part of my confusion.
Here be the relevant code:
# Request object from API
r <- GET(
"https://maps.googleapis.com/maps/api/distancematrix/json",
query = list(
origins = places,
destinations = places,
key = "INSERT API KEY HERE")
)
stop_for_status(r)
distances <- content(r)
The variable 'places' is simply a list containing the locations that I want distances to/from.
RTM?
Each query sent to the Google Maps Distance Matrix API is limited by
the number of allowed elements, where the number of origins times the
number of destinations defines the number of elements.
The Google Maps Distance Matrix API has the following limits in place:
Standard Usage Limits
Users of the standard API:
2,500 free elements per day
100 elements per query
100 elements per 10 seconds
Ergo: I think you have to split it up into several queries, with a 10 seconds pause in between, in order to get the full distance matrix.

Resources