City
todo
- class blocksnet.models.city.BuildingRow(*, geometry: Point, index: int, population: int = 0, floors: float, area: float, living_area: float, is_living: bool)[source]
Bases:
BaseRow- geometry: Point
- population: int
- floors: float
- area: float
- living_area: float
- is_living: bool
- class blocksnet.models.city.ServiceRow(*, geometry: Point, index: int, capacity: int)[source]
Bases:
BaseRow- geometry: Point
- capacity: int
- class blocksnet.models.city.Block(**data: Any)[source]
Bases:
BaseModelClass presenting city block
- id: int
Unique block identifier across the
`city`
- geometry: InstanceOf[Polygon]
Block geometry presented as shapely
`Polygon`
- landuse: str
Current city block landuse
- buildings: InstanceOf[gpd.GeoDataFrame]
Buildings
`GeoDataFrame`
- services: InstanceOf[dict[ServiceType, gpd.GeoDataFrame]]
Services ```GeoDataFrames```s for different ```ServiceType```s
- property area
- property industrial_area
- property living_area
- __contains__(service_type_name: str) bool[source]
Returns True if service type is contained inside the block
- __getitem__(service_type_name: str) dict[str, int][source]
Get service type capacity and demand of the block
- update_buildings(gdf: GeoDataFrame[BuildingRow] | None = None)[source]
Update buildings GeoDataFrame of the block
- update_services(service_type: ServiceType, gdf: GeoDataFrame[ServiceRow] | None = None)[source]
Update services GeoDataFrame of the block
- property is_living: bool
- property population: int
Return sum population of the city block
- classmethod from_gdf(gdf: GeoDataFrame, city: City) dict[int, blocksnet.models.city.Block][source]
Generate blocks dict from
`GeoDataFrame`
- class blocksnet.models.city.City(blocks_gdf: GeoDataFrame, adjacency_matrix: DataFrame)[source]
Bases:
object- epsg: int
- adjacency_matrix: DataFrame
- property blocks: list[blocksnet.models.city.Block]
Return list of blocks
- property service_types: list[blocksnet.models.service_type.ServiceType]
Return list of service types
- get_service_type_gdf(service_type: ServiceType | str)[source]
- update_services(service_type: ServiceType | str, gdf: GeoDataFrame)[source]
Update services in blocks of certain service_type
- add_service_type(service_type: ServiceType)[source]