HERE traffic api - Getting historical traffic data - here-api

I would like to get a traffic data map tile for a specific time. To do this,
https://developer.here.com/documentation/map-tile/dev_guide/topics/resource-traffic-flowbasetile.html as written in the documentation, I passed the "time" parameter. however, it looks like it does not work properly.
Requested example URL:
https://1.traffic.maps.ls.hereapi.com/maptile/2.1/traffictile/newest/normal.day/13/4358/2842/512/png?apiKey=apikey&ppi=500&time=2021-08-03T16:00:00Z
The response of real time traffic data on 2021-09-21T16:31:00z. I got this result without passing time parameter at exactly this time 2021-09-21T16:31:00z.
https://1.traffic.maps.ls.hereapi.com/maptile/2.1/traffictile/newest/normal.day/13/4358/2842/512/png?apiKey={apikey}&ppi=500
The response of data when I passed the time parameter.
https://1.traffic.maps.ls.hereapi.com/maptile/2.1/traffictile/newest/normal.day/13/4358/2842/512/png?apiKey={apikey}&ppi=500&time=2021-09-21T16:31:00z
As I tested the historical data response with my already saved response(when i requested to realtime traffic data) they are not same. Historical traffic data always returns similar response with little changes but they are not right.
It even returns result for future dates like 2022. Is the API broken? It works for realtime traffic data but has problems when i specify the time.

In Here Map Tile V2, you need to pass a timestamp after 2009, as a time before the year 2009 is not supported. For rest, the historical traffic data tile works well.

To achieve your request you should not use a time before year 2009 as this is not supported.
Response with Time parameter --
https://1.traffic.maps.ls.hereapi.com/maptile/2.1/traffictile/newest/normal.day/13/4358/2842/512/png?apiKey={YOUR_API_KEY}&ppi=500&time=2021-09-13T16:00:00z
Also please check the documentation for your reference.
https://developer.here.com/documentation/map-tile/dev_guide/topics/resource-traffic-traffictile.html

Related

speed limits on highway

I would like to do a project on speed limits on highways in germany. I want to know the distance between changes of the speed limit. To do this I need get a dataset which includes the speed limit traffic signs or the areas where a speed limit is set along ONE highway.
I havent worked with here yet. And before I dig into the details I would like to know if here is the right tool to do this project. And of course it would be nice if you could also tell me briefly how to do it, since I dont't even know where to start in here :)
Thanks a lot!
I tried Openstreetmaps before, but the data is too outdated. For example you cannot see speed limits due to construction works.
I found this link on other posts https://github.com/seaBass3/here-pde-speed-limit
but it seems not valid any more
This can be solved by different approaches, but one the most feasible, is the following:
By using the tool HereTraffic API v7 you can get real-time traffic flow and information about traffic signs, by using query parameters, response structures, and data types.
You can get all the information required on real-time traffic flow data in JSON, including information on speed and jam factor for the region(s) defined in each request. Can also deliver additional data such as the geometry of the road segments in relation to the flow.
Provides aggregated information about traffic incidents in JSON, including the type and location of each traffic incident, status, start and end time, and other relevant data. This data is useful to dynamically optimize route calculations.
And if you need historical information also like from past dates you can always use Here Probe Data to get the data which can be compared with different datasets.
This is one of the examples you can use in order to get all the information you need:
curl -H "Authorization: Bearer $TOKEN" "https://data.traffic.hereapi.com/v7/flow?locationReferencing=shape&in=bbox:13.400,52.500,13.405,52.505"

Trouble Requesting Data - Historical Traffic

I am trying to extract historical traffic data.
The documentation specified the time needs to be in the format: 2022-08-31T00:00:00-07:00 (midnight today).
My issue is that no matter what time I enter it only returns data associated with right now.
I have written a function that would extract traffic data every 15 minutes for a historical date and bounding box, however, it does not return unique data.
An example request URL is as follows:
https://traffic.ls.hereapi.com/traffic/6.2/flow.json?apiKey=#############&bbox=50.08518,-123.237232;49.447285,-123.049602&units=metric&responseattributes=shape&time=2022-08-31T00:00:00-07:00&minjamfactor=0
Could anyone assist with how exactly to extract historical traffic data for a given time?
Sorry for the inconvenience. But the current HERE traffic API V6.2/V7 provides the real-time traffic and incidents, not the historical traffic data.

Different summary total from dimension year,month and channel grouping from google analytics api

I got a rare problem with our account, I using google API v3 to get data from google analytics.
the first request using dimension ga:year ga:month
second request using dimension ga:channelGrouping
both requests have a similar for another parameter:
start date (2015-07-17) end date (2019-11-27)
metrics a:goalCompletionsAll,ga:goalConversionRateAll,ga:goalValueAll,ga:sessions,ga:pageviewsPerSession,ga:avgSessionDuration,ga:percentNewSessions,ga:bounceRate,ga:users,ga:pageviews
and different summary start when start date under 27 Sept 2017
has anyone experienced the same thing?
Considering the large period of time analyzed and that you are querying a non-standard report, it's likely that you're getting sampled data.
About data sampling: https://support.google.com/analytics/answer/2637192?hl=en
You can specify the sampling level to use for a request by setting the samplingLevel parameter: https://developers.google.com/analytics/devguides/reporting/core/v3/reference
You can understand if a Core Reporting API response contains sampled data by containsSampledData field in the response (in this case the containsSampledData response field will be true).
Note: Data is sampled when reports that include the Users and Active Users metrics include data from before September 2016.

HERE Traffic Incident API Call Not Displaying Accidents

I am using a HERE API call to request traffic incident data from a particular start time. Whenever I include the "type" key and specify "Accident" as the value, no response is returned. However, switching the value to "Construction" does provide a response.
Does anyone have information on how to make the API call return accident data specifically?
Here is the exact call I am using:
https://traffic.api.here.com/traffic/6.3/incidents.json?app_id={{app_id}}&app_code={{app_code}}&startTime=2017-01-01T00:00:00-05:00&type=Accident&bbox=52.5233,13.4035;52.5181,13.4159
There is no data returned as there are no “Accident” type incidents in that location. This can be seen when skipping the “type” parameter:
https://traffic.api.here.com/traffic/6.3/incidents.xml?app_id=APP_ID&app_code=APP_CODE&startTime=2017-01-01T00:00:00-05:00&bbox=52.5233,13.4035;52.5181,13.4159
Traffic Data is dynamic data. Accident can be located somewhere and disappear in a matter of minutes. We recommend to use wego.here.com to locate an accident, or Bing maps (they are all using our services and traffic data).
We were able to find one in Germany right now (should be there until 13:34 German time):
https://traffic.api.here.com/traffic/6.3/incidents.xml?app_id=app_id&app_code=app_code&startTime=2017-01-01T00:00:00-05:00&prox=51.52427,11.85887,15&type=Accident
Hope this helps! Happy Coding!

Here-API - Getroute historical route data

I have searched the questions here and gone through a fair amount of the API. I have not found reference to requesting historic route data. My questions is this; Does the Here api support historical route data. An example request would be that I seek the mileage from point a to point b 365 days ago, when perhaps a key route obstruction existed such as a bridge was out or a road was closed for construction that resulted in more miles during that historic period.
I would like to answer this in two parts
Can a route be calculated for a past date ?
Yes, you can. You need to request a Time Aware Route like below. You can read more about it in the developer site.
`
GET https://route.api.here.com/routing/7.2/calculateroute.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&mode=fastest;car;
&waypoint0=geo!37.743385,-122.422835
&waypoint1=geo!37.743878,-122.423686
&departure=2014-03-12T10:00:00
&routeattributes=sh,bb,g
`
Will the map used for the query depend on the departure date ?
No, Here API always uses the current version of the map available unless you specify explicitly the map version. But you can specify only till previous two releases.
So for your question, you wont be able to get the map data for a past year even using map version. But what you can do, is explicitly avoid the bridge or road newly constructed so that the api doesn't suggest that route. You can do this through Custom Route Extension API like below example.
GET http://cre.api.here.com/2/overlays/upload.json
?map_name=OVERLAYBLOCKROAD
&overlay_spec=[{"op":"override","shape":[[50.10765,8.68774],[50.10914,8.68771]],"layer":"LINK_ATTRIBUTE_FCN","data":{"VEHICLE_TYPES":"0"}}]
&storage=readonly
&app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}

Resources