Count segments in a geometry

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Returns the number of segments for a given geometry, regardless of whether they have data for the given parameters (mode, source, year, and filters such as roadway_classification).

The results from this endpoint should never be lower than the number of rows returned by the metrics endpoint but may be higher.

When source is agps (including mode: truck), segment_count is an array of objects keyed by OSM vintage, for example [{"202302": 123}]. For other sources, segment_count is an integer.

For mode: truck, use country: us, source: agps, and a year of 2023 or 2024. When source is agps, year is required unless osm_vintage is provided. See Truck metrics.

Body Params

Request body shared by the segment count and geometry endpoints.

geometry
required

Geometry used in a query, provided as one of the following geometry types:

  • segment_id: An array of segment IDs
  • radius: A radius around a point
  • nearest: Segments nearest to a point
  • polygon: A bounding polygon
  • tract_id, zip_id, blockgroup_id, taz_id,: IDs for various local aggregations (US-only)
  • places_2020: 7-digit FIPS code from the 2020 U.S. census, where the first 2 digits are the state code and the last 5 digits are the place code. (US-only)
  • dissemination_area_id, census_division_id, census_subdivision_id: IDs for various local aggregations (CAN-only)
  • osm_id: An array of OSM IDs
string
enum
required
Defaults to us

Country code for the query area.

Allowed:
string
enum
required
Defaults to vehicle

Travel mode for the query.
See Available Metrics for mode-specific fields and constraints.

Allowed:
string
enum

The data source that will be used. Check the Available Metrics and Date Ranges for each data source.

Requests that do not specify this parameter default to lbs_plus, except mode: truck which uses agps.

Allowed:
osm_vintage
array of integers
length ≤ 2

The OpenStreetMap (OSM) snapshot that defines segments queried, where 202302 is February 2023, 202501 is January 2025, and 202601 is January 2026.

For the agps data source, this parameter is optional; when omitted, the server selects the vintage from the requested date or year.

Vintage selection guidelines:

  • Use 202302 for metrics from December 2024 and earlier.
  • Use 202501 for metrics from 2025.
  • Use 202601 for metrics from January 2026 and later.
  • Use two vintages for a date range that spans vintages.

When mode is truck, only 202302 is supported and the parameter defaults to [202302] when omitted.

osm_vintage
Allowed:
roadway_classification
object

If specified, only segments with the given OSM roadway classifications will be returned.
When mode is truck, service is not permitted.

integer
2000 to 2099

Specify the year for which you want geometry or segment counts so that the road network is consistent with the year you are querying.

When source is agps, year is required unless osm_vintage is provided.

Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json