Skip to content

81 buildings

image image image

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.

1
# %pip install -U leafmap geopandas
1
import leafmap

Specify the country name.

1
country = "Libya"

Specify the number of files to download. Set to None to download all files.

1
head = 2

Download the Microsoft building footprints.

1
2
3
leafmap.download_ms_buildings(
    country, out_dir="buildings", merge_output=f"{country}_ms.shp", head=head
)

Display the Microsoft building footprints.

1
2
3
4
m = leafmap.Map()
m.add_basemap("SATELLITE")
m.add_vector(f"{country}_ms.shp", layer_name="MS Buildings")
m

Download the Google building footprints.

1
2
3
4
5
6
7
leafmap.download_google_buildings(
    country,
    out_dir="buildings",
    merge_output=f"{country}_google.shp",
    head=head,
    overwrite=True,
)

Display the Google building footprints.

1
url = "https://sites.research.google/open-buildings/tiles.geojson"
1
2
3
4
5
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