How to Download Google and Microsoft Building Footprints Dataset

I remember a long time ago when I started working as a GIS officer, digitizing building footprints was a time-consuming and exhausting task. I often imagined how convenient it would be to have an alternative option that could automatically generate building footprints from high-resolution satellite imagery. Such an option would undoubtedly be a tremendous help in obtaining building footprint data for my city.

Time passed, and now my imagination has become a reality. Through the use of machine learning and deep learning methods, combined with reliable and powerful computing infrastructure, it is possible to seamlessly generate building footprints not only for small cities like mine but also for the entire globe. Two major companies, Google and Microsoft, seem to be in fierce competition to become the world's leading spatial data providers. They have been processing a vast amount of high-resolution satellite imagery to generate building footprints for the entire world. This is an incredible achievement!

But now the question arises: how can you download the building data from Google and Microsoft for your interest location? In this post, I will show you how to download the data manually from the source page and also in Google Earth Engine. Keep reading!

Download Google Open Building

For Google open building footprints, you can download it directly from Google open building page. From this page, manually you can download each cell that corresponding to your area of interest as seen in the figure 1.

Google Open Building Download Cell
Figure 1. Google Open Building Download Cell
 

If you don't know which cell is for your location. Search for it using the searching tool. For example, I want to download building footprints for Cape Town city, South Africa. Type "Cape Town" in the searching tool, then it will zoom in to Cape Town right away. Click the cell and a pop up window will appear to tell me the size of the data as you can see in the figure 2.

Google Open Building Download Cell for Cape Town
Figure 2. Google Open Building Download Cell for Cape Town

The downloaded data is in CSV format. Each row in the CSV represents one building polygon or point with the following columns:

  • latitude: latitude of the building polygon centroid,
  • longitude: longitude of the building polygon centroid,
  • area_in_meters: area in square meters of the polygon,
  • confidence: confidence score [0.65;1.0] assigned by the model,
  • geometry: the building polygon in the WKT format (POLYGON or MULTIPOLYGON). This feature is present in only in polygons data,
  • full_plus_code: the full Plus Code at the building polygon centroid,
As we all know CSV is a text file that separated values by commas. It's not a common geospatial data format like geojson, geopackage, shapefile, etc. But don't worry you can open CSV data in a GIS software to see the buildings. Check out this tutorial: How to Open Spatial Data Format in CSV

Download Microsoft Building Footprints Dataset

The Microsoft buildings footprint dataset can be downloaded from GlobalMLBuildingFootprints Github repository. In this page you can find detail information about the data such as: data update, region coverage, data format, evaluation metrics, etc.

The downloaded data is in GeoJSON format. It's quite convenient using this type of spatial data format in a GIS software, but unfortunately the data is so big up to GB in size. Luckily Microsoft aware about this. For that, they provide a Python script to split the data into smaller pieces. The code can be found here.

To use the code to split the buildings into smaller parts, follow the steps below:

1. After download the code, put it in a folder which also contain the downloaded building dataset.

2. Open the code using a text editor, then change the input file at line 10 and output file at line 16. For example, I want to split Indonesia's building footprints data with a total size 20.7 GB, therefore I changed the input file into indonesia.geojsonl and also the output file as seen in the figure 3 below.   

Python Script to Split Microsoft Building Footprints
Figure 3. Python Script to Split Microsoft Building Footprints

3. Open a terminal or command prompt, make sure the path is in the folder. Then type: python3 python-script-name.py. The building footprints will be segmented into 10000 buildings with 3 MB size for each file. The output when running the code can be seen in the figure 4.

Splitting Microsoft Building Footprints into Smaller Segment
Figure 4. Splitting Microsoft Building Footprints into Smaller Segment

Download Google and Microsoft Building From Google Earth Engine

Downloading the building footprints manually both from Google and Microsoft give us such a big data for a large area of a country scope or a cell. What about if we want to download at a specific area of interest. For that we can do it in Google Earth Engine.

To download the building data in Google Earth Engine, follow the step below.

1. Open the Google Earth Engine code editor. Copy the following code into the code editor.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//MICROSOFT BUILDING FOLDER. CHECK IT FOR A SPECIFIC COUNTRY
var ee_folder = ee.data.listAssets("projects/sat-io/open-datasets/MSBuildings");
print(ee_folder)

//BUILDING FEATURE COLLECTION FOR MICROSOFT AND GOOGLE
var s_africa_ms = ee.FeatureCollection('projects/sat-io/open-datasets/MSBuildings/South_Africa');
var google_building = ee.FeatureCollection('GOOGLE/Research/open-buildings/v3/polygons');

//CLIP BUILDING WITH AOI
var ms_clip=s_africa_ms.filterBounds(AOI)
var google_clip=google_building.filterBounds(AOI)

//ADD BUILDING TO THE MAP
Map.addLayer(ms_clip, {color: 'blue'}, 'Microsoft Buildings of South Africa');
Map.addLayer(google_clip, {color: 'yellow'}, 'Google Buildings of South Africa');

//SET MAP CENTER
Map.setCenter(18.42, -33.92, 14);  //Cape Town,  South Africa

//EXPORT DATA TO GOOGLE DRIVE IN GEOJSON FORMAT
Export.table.toDrive({
  collection: google_clip,
  description: 'google_clip',
  folder: 'GEE',
  fileFormat:'GeoJSON',
});

The code above is self explanatory cause I added comments at each section. If you observe the code, you can spot the difference between Microsoft and Google building's feature collection. Microsoft building footprints are stored at different location or folder for each country. Therefore you need to check a country's name with listAssets method as in line 2. On the other hand, Google has one feature collection that store all building data.

3. To clip the building footprints for an area of interest, we use filterBounds function as you can see at line 10 and 11. In the code, there is a variable which is called AOI. It's not exist in the code yet. You can create an AOI boundary using the geometry drawing tool and import it to the existing code as shown in the figure 5. Don't forget to change the boundary polygon's name from geometry to AOI.

GEE Drawing Tool to Create a Boundary Polygon
Figure 5. GEE Drawing Tool to Create a Boundary Polygon

 4. Run the code. The clipped building will be added into the map as in figure 6. You can see both building footprints in two different layers.

Display Google and Microsoft Open Building in GEE
Figure 6. Display Google and Microsoft Open Building in GEE

5. To export the data click the Tasks tab, then Run the UNSUBMITTED TASKS. The export interface window will appear as in figure 7 in case you want to change something like Drive folder's name, Filename, etc.

GEE Export Interface
Figure 7. GEE Export Interface





6. After Running the task, the exported building data will be saved in the defined folder in your Google Drive. From there you can download the file into your local storage. Figure 8 below is the downloaded data that visualized in QGIS.

Google and Microsoft Open Building Footprints Visualized in QGIS
Figure 8. Google and Microsoft Open Building Footprints Visualized in QGIS
 

That's all for this tutorial on how to download Google and Microsoft open data building footprints. We have learned how to download both datasets manually from the source web pages, split the data into smaller parts to read it faster, and finally download the data for an area of interest using Google Earth Engine. Hopefully, this tutorial is useful. Thank you for reading!

Anyway if you look for other open data that available and free to download check out this post: Some Free Open Data You Should Know.


Related Posts

Disqus Comments