Skip to main content
`Ctrl`+`K`

# aequilibrae.project.Zone

class aequilibrae.project.Zone(dataset: dict, zoning)

  Single zone object that can be queried and manipulated in memory

  __init__(dataset: dict, zoning)

  Methods

  `__init__`(dataset, zoning) |
  `add_centroid`(point[, robust]) | Adds a centroid to the network file
  `connect_db`() |
  `connect_mode`(mode_id[, link_types, ...]) | Adds centroid connectors for the desired mode to the network file
  `delete`() | Removes the zone from the database
  `disconnect_mode`(mode_id) | Removes centroid connectors for the desired mode from the network file
  `save`() | Saves/Updates the zone data to the database

  add_centroid(point: Point, robust=True) → None

    Adds a centroid to the network file

    Arguments:

      point (`Point`): Shapely Point corresponding to the desired centroid position. If None, uses the geometric center of the zone

      robust (`Bool`, Optional): Moves the centroid location around to avoid node conflict. Defaults to `True`.

  connect_db()
  connect_mode(mode_id: str, link_types='', connectors=1, conn: Connection | None = None, limit_to_zone=True) → None

    Adds centroid connectors for the desired mode to the network file

    Centroid connectors are created by connecting the zone centroid to one or more nodes selected from all those that satisfy the mode and link_types criteria and are inside the zone.

    The selection of the nodes that will be connected is done simply by searching for the node closest to the zone centroid, or the N closest nodes to the centroid.

    If fewer candidates than required connectors are found, all candidates are connected.

    Arguments:

      mode_id (`str`): Mode ID we are trying to connect

      link_types (`str`, Optional): String with all the link type IDs that can be considered. eg: yCdR. Defaults to ALL link types

      connectors (`int`, Optional): Number of connectors to add. Defaults to 1

      conn (`sqlite3.Connection`, Optional): Connection to the database.

      limit_to_zone (`bool`): Limits the search for nodes inside the zone. Defaults to `True`.

  delete()

    Removes the zone from the database

  disconnect_mode(mode_id: str) → None

    Removes centroid connectors for the desired mode from the network file

    Arguments:

      mode_id (`str`): Mode ID we are trying to disconnect from this zone

  save()

    Saves/Updates the zone data to the database