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 range of months or years with the date_range parameter in the Get metrics for a geometry endpoint.
Use
date_rangesrather thandateto analyze time trends. Usedatewhen you want metrics for one month or one year. You must includeyear_monthin thefieldsparameter as part of the metrics request when you usedate_ranges.
Month-over-month time trends
For example, the following values for the date_ranges parameter in the Get metrics for a geometry endpoint would get metrics for October through December 2021, allowing you to analyze month-over-month time trends.
"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 values for the date_ranges parameter would get metrics for the entire years of 2020 through 2022, allowing you to analyze year-over-year time trends.
"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 about 1 month ago
