This lesson has notes and guides only.
00:00
In this video we're going to walkthrough how to use TrajectoryByPath. So why use this endpoint?TrajectoryByPath is a backend to our Trajectory Analysis graph that you see on the Road Intelligence platform in the Path Analysis tool. It gives you all the road-matched trips that have had a high enough packet frequency to be considered as part of the Trajectory Analysis.
00:18
Within each packet, you'll get the number of stops for each trip and how long it took for the vehicle to cross the path. This endpoint gives you the processed data that you see in the front-end of our platform, so that you can use it in your own models. Since this is a streaming endpoint, once you send a request, the API will continue to stream packets for your specified linestring and time period.
00:37
Now let's look at how to set up a request. Before we start, make sure you are authenticated. If not, use the Authenticate endpoint. To get started, first select TrajectoryByPath from the left menu. In the Docs tab, you'll see what information you need to give in your request and what you will receive in its response. Next, we'll switch to the Try It tab.
00:58
To build your request, first you'll need to put in the WKT linestring you want data for. You can export WKTs from the Road Intelligence platform. Then use start date and end date to define the date and time range you want to extract the data for.
01:19
You can filter data by specific hours of the day, for example 9 and 15 if you want to see only data for 9 a.m. and 3 p.m. If you want all hours, leave it blank. You can also filter by day of week and exclude specific dates from your request. These dates need to be added individually and not as a range. If you don't want to have any exclusions, you can delete these.
01:42
You can also limit how many data packets you want to receive for the selected time period. If I put 30 in here, it means I'll get the first 30 data packets for my linestring and date range. If you want everything, remove this field.
01:58
For our streaming APIs, you can change the throttle. This means you can slow down or increase the stream speed. For now I'll leave it as is. Now click Start. It may take a few seconds. You'll have a packet count on the right hand side here, and by clicking the Stop button, you can stop the stream.
02:21
Within each packet, there is the trip ID; start time of the trip; vehicle type; the points included in the whole trip, including seconds from the start that it was recorded, and distance along the selected path; and the number of stops.
02:36
And that's it. In this lesson, we learned what the TrajectoryByPath endpoint is, how to set up your request, and start the streaming. If you want to use this endpoint via our SDK files, check out our GitHub link in the lesson notes below. We'll see you in the next lesson.
We'd love to hear what you think. Leave your details below if you'd like to be contacted.