aequilibrae.project.Zoning#
- class aequilibrae.project.Zoning(network)[source]#
Access to the API resources to manipulate the zones table in the project
>>> from aequilibrae import Project >>> project = Project.from_path("/tmp/test_project") >>> zoning = project.zoning >>> zone_downtown = zoning.get(1) >>> zone_downtown.population = 637 >>> zone_downtown.employment = 10039 >>> zone_downtown.save() # changing the value for an existing value/field >>> project.about.scenario_name = 'Just a better scenario name' >>> project.about.write_back() # We can also add one more field to the table >>> fields = zoning.fields >>> fields.add('parking_spots', 'Total licensed parking spots', 'INTEGER')
Methods
__init__
(network)Returns a dictionary with all Zone objects available in the model.
coverage
()Returns a single polygon for the entire zoning coverage
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
save
()Attributes
Returns all zones data as a Pandas DataFrame
Returns a FieldEditor class instance to edit the zones table fields and their metadata
- new(zone_id: int) Zone [source]#
Creates a new zone
- Returns:
zone (
Zone
): A new zone object populated only with zone_id (but not saved in the model yet)
- create_zoning_layer()[source]#
Creates the ‘zones’ table for project files that did not previously contain it
- coverage() Polygon [source]#
Returns a single polygon for the entire zoning coverage
- Returns:
model coverage (
Polygon
): Shapely (Multi)polygon of the zoning system.
- all_zones() dict [source]#
Returns a dictionary with all Zone objects available in the model. zone_id as key
- get_closest_zone(geometry: Point | LineString | MultiLineString) int [source]#
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
orLineString
): A Shapely geometry object- Returns:
zone_id (
int
): ID of the zone applicable to the point provided
- property data: DataFrame#
Returns all zones data as a Pandas DataFrame
- Returns:
table (
DataFrame
): Pandas DataFrame with all the zones, complete with Geometry
- 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.
- property fields: FieldEditor#
Returns a FieldEditor class instance to edit the zones table fields and their metadata