Identifying vacant area of a city block

[1]:

import osmnx as ox import pandas as pd import geopandas as gpd import warnings import sys import os warnings.filterwarnings("ignore") sys.stderr = open(os.devnull, 'w') # local crs local_crs = 32636 # path to data example_data_path = "./data"
[2]:
# load aggregated info we have
aggregated_blocks = gpd.read_parquet(os.path.join(example_data_path, "data_getter_blocks.parquet"))
accessibility_matrix = pd.read_pickle(os.path.join(example_data_path, "data_getter_matrix.pickle"))
[3]:
# load data required for service graphs creation
schools = gpd.read_parquet(os.path.join(example_data_path, "schools.parquet"))
kindergartens = gpd.read_parquet(os.path.join(example_data_path, "kindergartens.parquet"))
recreational_areas = gpd.read_parquet(os.path.join(example_data_path, "recreational_areas.parquet")).rename_geometry('geometry')

hospitals = gpd.read_file(os.path.join(example_data_path, "hospitals.geojson"))
pharmacies = gpd.read_file(os.path.join(example_data_path, "pharmacies.geojson"))
policlinics = gpd.read_file(os.path.join(example_data_path, "policlinics.geojson"))
[4]:
from blocksnet.models import City

city_model = City(
  blocks_gdf=aggregated_blocks,
  matrix=accessibility_matrix
)
[5]:
from blocksnet.method.vacant_area import VacantArea
[6]:
vacant_area = VacantArea(city_model=city_model)
[7]:
result = vacant_area.get_vacant_area(block=47)
result
[7]:
geometry area length
0 POLYGON ((344370.633 6649857.907, 344370.733 6... 302.529379 91.662110
1 POLYGON ((344632.739 6650059.661, 344632.790 6... 821.101456 194.009073
2 POLYGON ((344729.984 6649842.412, 344729.974 6... 843.882156 177.169821
3 POLYGON ((344888.499 6649874.695, 344888.415 6... 351.594560 99.495123
4 POLYGON ((344823.830 6650005.583, 344823.771 6... 223.367378 69.074718
5 POLYGON ((344834.233 6650095.133, 344833.800 6... 1321.637595 213.157374
6 POLYGON ((344890.869 6650207.982, 344890.968 6... 223.643318 70.381360
7 POLYGON ((344967.148 6649828.113, 344967.095 6... 519.041872 122.626470
8 POLYGON ((345055.659 6649853.976, 345055.724 6... 444.651221 136.009538
9 POLYGON ((345011.465 6649937.715, 345011.518 6... 322.191612 87.201376
10 POLYGON ((345182.363 6649876.280, 345182.413 6... 457.249468 97.316819
11 POLYGON ((345210.361 6649911.677, 345210.337 6... 389.420927 91.830279
12 POLYGON ((345098.138 6649986.734, 345098.151 6... 598.270227 140.048195
[8]:
result.explore()
[8]:
Make this Notebook Trusted to load map: File -> Trust Notebook