Skip to content

Add Zone IDs

Assigns each location in the survey to the zones of every configured zone system (for example TAZ and MAZ). Each system adds one column per location, named after the zone system: home_taz, work_taz, o_taz and so on. A point outside every zone can be snapped to the nearest one within max_snap_distance, or left null.

It runs after extract_tours, so tours get zones too, and before cascade_completeness, so a usability profile can require that a record has a zone.

Add zone IDs for multiple geographic levels based on locations.

Automatically applies each zone geography to standard locations:

  • households: home_lon/lat → home_{zone_name}
  • persons: work_lon/lat → work_{zone_name}, school_lon/lat → school_{zone_name}
  • unlinked_trips, linked_trips, tours: o_lon/lat → o_{zone_name}, d_lon/lat → d_{zone_name}
  • habitual_locations: lon/lat → {zone_name}, so a workplace found from trips can stand in as a model's usual workplace

Example

Example
- name: add_zone_ids
  params:
    projected_crs: "EPSG:26910"  # UTM Zone 10N, for the nearest-zone snap
    max_snap_distance: 500       # meters; points farther from every zone stay null
    zone_geographies:
      - zone_name: taz
        shapefile: zones/taz.shp
        zone_id_field: TAZ_NODE
      - zone_name: maz
        shapefile: zones/maz.shp
        zone_id_field: MAZ_NODE

Settings

Key Type Default Meaning
zone_geographies list required List of dicts, each containing: - shapefile: Path to shapefile with zone boundaries (str) - zone_id_field: Field name in shapefile for zone ID - zone_name: Short name for zone type (e.g., 'taz', 'maz', 'county')
projected_crs text or null null Optional EPSG string (e.g. 'EPSG:26910') for the metric CRS to use when snapping unmatched points to the nearest zone. If None, no nearest-zone fallback is performed.
max_snap_distance number or null null Maximum snap distance in projected_crs units (metres for UTM). Unmatched points farther than this from all zone boundaries are left null (assumed out-of-region). None means no distance limit. Only used when projected_crs is set.

Code: processing.add_zone_ids