Skip to content

Instantly share code, notes, and snippets.

@nj935
Created October 13, 2019 23:19
Show Gist options
  • Save nj935/41b0146dc8e7157ac284edf840fa68f9 to your computer and use it in GitHub Desktop.
Save nj935/41b0146dc8e7157ac284edf840fa68f9 to your computer and use it in GitHub Desktop.
import geopandas as gpd
import osmnx as ox
from shapely.geometry import box
def plot_square_mile(point):
dist = 612
# download the footprints and project them into local CRS
footprints = ox.footprints.footprints_from_point(point=point, distance=dist)
footprints_proj = ox.project_gdf(footprints)
# plot the footprints
bbox = ox.bbox_from_point(point=point, distance=dist, project_utm=True)
fig, ax = ox.footprints.plot_footprints(footprints_proj, bgcolor='k', color='orange', figsize=(6,6), bbox=bbox)
# calculate and print the building footprint area
footprint_area = footprints_proj.area.sum()
print("Area of building footprints: ", footprint_area)
point = (18.526437, -72.350451) # near the Seminaire Theologique (STEP)
plot_square_mile(point)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment