81 buildings
Downloading Microsoft and Google Building Footprints
This notebook demonstrates how to download Microsoft and Google Building Footprints and merge them into a single vector file.
- Microsoft Global Building Footprints: https://github.com/microsoft/GlobalMLBuildingFootprints
- Google Open Buildings: https://sites.research.google/open-buildings
Uncomment the following line to install leafmap if needed.
In [ ]:
Copied!
# %pip install -U leafmap geopandas
# %pip install -U leafmap geopandas
In [ ]:
Copied!
import leafmap
import leafmap
Specify the country name.
In [ ]:
Copied!
country = "Libya"
country = "Libya"
Specify the number of files to download. Set to None
to download all files.
In [ ]:
Copied!
head = 2
head = 2
Download the Microsoft building footprints.
In [ ]:
Copied!
leafmap.download_ms_buildings(
country, out_dir="buildings", merge_output=f"{country}_ms.shp", head=head
)
leafmap.download_ms_buildings(
country, out_dir="buildings", merge_output=f"{country}_ms.shp", head=head
)
Display the Microsoft building footprints.
In [ ]:
Copied!
m = leafmap.Map()
m.add_basemap("SATELLITE")
m.add_vector(f"{country}_ms.shp", layer_name="MS Buildings")
m
m = leafmap.Map()
m.add_basemap("SATELLITE")
m.add_vector(f"{country}_ms.shp", layer_name="MS Buildings")
m
Download the Google building footprints.
In [ ]:
Copied!
leafmap.download_google_buildings(
country,
out_dir="buildings",
merge_output=f"{country}_google.shp",
head=head,
overwrite=True,
)
leafmap.download_google_buildings(
country,
out_dir="buildings",
merge_output=f"{country}_google.shp",
head=head,
overwrite=True,
)
Display the Google building footprints.
In [ ]:
Copied!
url = "https://sites.research.google/open-buildings/tiles.geojson"
url = "https://sites.research.google/open-buildings/tiles.geojson"
In [ ]:
Copied!
m = leafmap.Map()
m.add_basemap("SATELLITE")
m.add_geojson(url, layer_name="Google Building Coverage")
m.add_vector(f"{country}_google.shp", layer_name="Google Buildings")
m
m = leafmap.Map()
m.add_basemap("SATELLITE")
m.add_geojson(url, layer_name="Google Building Coverage")
m.add_vector(f"{country}_google.shp", layer_name="Google Buildings")
m