Skip to main content
`Ctrl`+`K`

# aequilibrae.project.Zoning

class aequilibrae.project.Zoning(network)

  Access to the API resources to manipulate the ‘zones’ table in the project

      >>> project = create_example(project_path, "coquimbo")

      >>> zoning = project.zoning

      >>> zone_downtown = zoning.get(1)
      >>> zone_downtown.population = 637
      >>> zone_downtown.employment = 10039
      >>> zone_downtown.save()

      # We can also add one more field to the table
      >>> fields = zoning.fields
      >>> fields.add('parking_spots', 'Total licensed parking spots', 'INTEGER')

  __init__(network)

  Methods

  `__init__`(network) |
  `all_zones`() | Returns a dictionary with all Zone objects available in the model, using `zone_id` as key
  `coverage`() | Returns a single polygon for the entire zoning coverage
  `create_zoning_layer`() | Creates the 'zones' table for project files that did not previously contain it
  `extent`() | Queries the extent of the layer included in the model
  `get`(zone_id) | Get a zone from the model by its `zone_id`
  `get_closest_zone`(geometry) | Returns the zone in which the given geometry is located.
  `new`(zone_id) | Creates a new zone
  `refresh_geo_index`() |
  `save`() |

  Attributes

  `data` | Returns all zones data as a Pandas DataFrame
  `fields` | Returns a FieldEditor class instance to edit the zones table fields and their metadata

  all_zones() → dict

    Returns a dictionary with all Zone objects available in the model, using `zone_id` as key

  coverage() → Polygon

    Returns a single polygon for the entire zoning coverage

    Returns:

      model coverage (`Polygon`): Shapely (Multi)polygon of the zoning system.

  create_zoning_layer()

    Creates the ‘zones’ table for project files that did not previously contain it

  extent() → Polygon

    Queries the extent of the layer included in the model

    Returns:

      model extent (`Polygon`): Shapely polygon with the bounding box of the layer.

  get(zone_id: str) → Zone

    Get a zone from the model by its `zone_id`

  get_closest_zone(geometry: Point | LineString | MultiLineString) → int

    Returns the zone in which the given geometry is located.

    > If the geometry is not fully enclosed by any zone, the zone closest to the geometry is returned

    Arguments:

      geometry (`Point` or `LineString`): A Shapely geometry object

    Returns:

      zone_id (`int`): ID of the zone applicable to the point provided

  new(zone_id: int) → Zone

    Creates a new zone

    Returns:

      zone (`Zone`): A new zone object populated only with `zone_id` (but not saved in the model yet)

  refresh_geo_index()
  save()
  property data: GeoDataFrame

    Returns all zones data as a Pandas DataFrame

    Returns:

      table (`GeoDataFrame`): GeoPandas GeoDataFrame with all the nodes

  property fields: FieldEditor

    Returns a FieldEditor class instance to edit the zones table fields and their metadata