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_ranges rather than date to analyze time trends. Use date when you want metrics for one month or one year. You must include year_month in the fields parameter as part of the metrics request when you use date_ranges.

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}
  },

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}
  },