Download open-source building footprints¶
In [2]:
Copied!
from urbanworm import UrbanDataSet
from urbanworm import UrbanDataSet
In [3]:
Copied!
# initialze dataset class
data = UrbanDataSet()
# initialze dataset class
data = UrbanDataSet()
We can download buildings with OSM or global buildings released from Bing map. We can get a bbox from bboxfinder.com
In [ ]:
Copied!
# OSM
data.bbox2Buildings(bbox=(-82.926822,42.440974,-82.920824,42.444236), source='osm')
# OSM
data.bbox2Buildings(bbox=(-82.926822,42.440974,-82.920824,42.444236), source='osm')
Out[ ]:
'206 buildings found in the bounding box.'
In [8]:
Copied!
data.units.plot()
data.units.plot()
Out[8]:
<Axes: >
In [4]:
Copied!
# global buildings
data.bbox2Buildings(bbox=(-82.926822,42.440974,-82.920824,42.444236), source='being')
# global buildings
data.bbox2Buildings(bbox=(-82.926822,42.440974,-82.920824,42.444236), source='being')
0%| | 0/1 [00:00<?, ?it/s]
Warning: Multiple rows found for QuadKey: 030223212. Processing all entries.
100%|██████████| 1/1 [00:11<00:00, 11.01s/it]
Out[4]:
'361 buildings found in the bounding box.'
In [10]:
Copied!
data.units.plot()
data.units.plot()
Out[10]:
<Axes: >
With the same extent, global building dataset may cover more building footprints than OSM.
In [23]:
Copied!
import matplotlib.pyplot as plt
gdf_proj = data.units.to_crs(2253)
gdf_proj['footprint_area'] = gdf_proj.geometry.area
# Plot polygons
fig, ax = plt.subplots(figsize=(12, 12))
gdf_proj.plot(ax=ax, column='footprint_area', scheme='Percentiles', alpha=0.9, legend=True, legend_kwds={"loc": "upper right"})
ax.set_title("Buildings with Area Labels")
ax.set_axis_off()
plt.show()
import matplotlib.pyplot as plt
gdf_proj = data.units.to_crs(2253)
gdf_proj['footprint_area'] = gdf_proj.geometry.area
# Plot polygons
fig, ax = plt.subplots(figsize=(12, 12))
gdf_proj.plot(ax=ax, column='footprint_area', scheme='Percentiles', alpha=0.9, legend=True, legend_kwds={"loc": "upper right"})
ax.set_title("Buildings with Area Labels")
ax.set_axis_off()
plt.show()
Some footprints that may be just garages need to be excluded.
In [24]:
Copied!
gdf_proj[gdf_proj['footprint_area'] > 880].plot()
gdf_proj[gdf_proj['footprint_area'] > 880].plot()
Out[24]:
<Axes: >