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 [1]:
Copied!
# %pip install -U leafmap geopandas
# %pip install -U leafmap geopandas
In [2]:
Copied!
import leafmap
import leafmap
Specify the country name.
In [3]:
Copied!
country = "Libya"
country = "Libya"
Specify the number of files to download. Set to None
to download all files.
In [4]:
Copied!
head = 2
head = 2
Download the Microsoft building footprints.
In [5]:
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
)
Found 84 links for Libya Downloading 1 of 2: 122003333.geojson Downloading 2 of 2: 122012202.geojson Reading 1 of 2: buildings/122003333.geojson Reading 2 of 2: buildings/122012202.geojson Merging GeoDataFrames ... Saving merged file to Libya_ms.shp ... Saved merged file to Libya_ms.shp
Out[5]:
['buildings/122003333.geojson', 'buildings/122012202.geojson']
Display the Microsoft building footprints.
In [6]:
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
Out[6]: