Defining Zones

StreetLight InSight® API

Use the Create a zone set endpoint to define the geography that you will analyze. You can define zones to analyze using either of the following:

  • A GeoJSON feature collection where the features are either MultiPolygons or LineStrings
  • A list of OpenStreetMap (OSM) road segment IDs

Defining zones with GeoJSON

A zone set defined with GeoJSON feature collection where the features are either MultiPolygons or LineStrings.

See the GeoJSON specification for details on format requirements.

If you're starting from a shapefile, you can use and adapt this recipe to convert it to GeoJSON:

Any GeoJSON feature in your zone set can include the following properties:

PropertyTypeRequiredDescription
namestringThe unique, case-insensitive name (max 50 chars) used to reference the zone in metrics.
idintegerOptional positive integer ID. Must be unique within the zone set.
is_passinteger (0/1) or nullRequired for LineString features. Determines if the zone captures pass-through traffic.
directioninteger (0–359)Direction of traffic (in degrees). Only applicable for pass-through zones.
is_bidiinteger (0/1) or nullIndicates bi-directional traffic capture. Requires is_pass and direction to be set. Default is "0".

Line Zones

Features with LineString geometry can define the following optional properties:

PropertyTypeDescription
road_typestringOne of: Primary, Secondary, Local, or Ramp.
gate_latfloatLatitude of the custom gate location.
gate_lngfloatLongitude of the custom gate location.
gate_sizeintegerSize (in meters) of the gate used for sampling.

Calibration Zones

To enable single-factor calibration for traffic, pedestrian, or bicycle data, use the following feature properties.

📘

For more information in the Help Center, see What is single factor calibration?

Vehicle Calibration Zones

PropertyTypeDescription
calibration_typestringOne of: ADT, AADT, AWDT, AAWDT.
calibration_valueintegerValue (0–1,000,000) based on selected calibration type.
personal_traffic_ratiofloatProportion of personal vehicle traffic (recommended: 0.96).
medium_commercial_ratiofloatProportion of medium-duty vehicles (recommended: 0.02).
heavy_commercial_ratiofloatProportion of heavy-duty vehicles (recommended: 0.02).

The three traffic ratios must sum to 1.0.

Pedestrian Calibration Zones

PropertyTypeDescription
has_pedestrian_calibrationbooleanEnable pedestrian calibration.
pedestrian_calibration_valueinteger (0–999,999)Required if above is true.

Bicycle Calibration Zones

PropertyTypeDescription
has_bike_calibrationbooleanEnable bicycle calibration.
bike_calibration_valueinteger (0–10,000)Required if above is true.

Defining Zones with OSM IDs

You can specify OpenStreetMap (OSM) segments directly using the osm_ids parameter in the zone set request. To get a list of OSM IDs for segments in a given geometry, use the Search OSM IDs endpoint.

The Network Origin-Destination analysis type requires zones to be defined with OSM IDs. You can also use zones defined with OSM IDs for any analysis type that allows OSM line segment zones from the zone library. For more information, see see What is the Zone Library?

zone_sets API Response

After a successful zone set creation, the response includes:

{
  "name": "MyCounty_Zones",
  "status": "success",
  "uuid": "a486a871-c610-4a0e-b87e-9b3c030862a1"
}

You can use either the name or uuid to reference this zone set in subsequent analysis requests.

Once created, the zone set also appears in the StreetLight InSight® web app.