Analyzing Time Trends
StreetLight Advanced Traffic Counts API
You can compare metrics month over month or year over year to analyze time trends.
When requesting metrics with the StreetLight Advanced Traffic Counts API, you can specify a series of months or years for which you want metrics. This allows you to compare metrics over the series of months ("month-over-month") or years ("year-over-year"), and analyze changes over time.
You can analyze month-over-month or year-over-year time trends by defining a contiguous range with the date_range parameter in the Get metrics for a geometry endpoint.
Use
date_rangefor contiguous months or years. Usedate_rangesonly for disjoint ranges withagps. Usedatefor a single month or year. Includeyear_monthinfieldswhen the response spans multiple periods.
Month-over-month time trends
For example, the following date_range in the Get metrics for a geometry endpoint would get metrics for October through December 2021:
"date_range": {
"start": {"month": 10, "year": 2021},
"end": {"month": 12,"year": 2021}
},Year-over-year time trends
If you only define a year for the start and end of the date range without specifying a month, you will get metrics for each year in the range. The following date_range would get metrics for 2020 through 2022:
"date_range": {
"start": {"year": 2020},
"end": {"year": 2022}
},Time trends from 2024 - 2025
With the agps source, you define an OSM vintage along with your geometry. If your date range includes months across 2024 and 2025, specifying both available OSM vintages is recommended. For example, the metrics call would include the following parameters:
"date_range": {
"start": {"month": 10, "year": 2024},
"end": {"month": 3,"year": 2025}
},
"osm_vintage": [202501, 202302],
This ensures that metrics are paired with the correct geometry for the year in which the data occurred. For more information, [Defining Geometry].
Updated 2 months ago
