Explore Data
The 25.01 release of the Global Dynamic Exposure (GDE) model — the EU Building Database — combines OpenStreetMap and other open geospatial data with probabilistic building-type assignments. It is distributed as a database (a shared PostGIS instance or a local SpatiaLite file) together with exposurelib, a Python library that provides a consistent interface for querying either database type.
This walkthrough uses a small sample database for Mexico City (CDMX): a by-building export, meaning it contains individual building footprints (category = 1 entities) rather than only Quadtree-tile aggregates.
# install necessary libraries - remove # to install
# !pip config set global.extra-index-url https://git.gfz-potsdam.de/api/v4/projects/2940/packages/pypi/simple
# !pip install exposurelib taxonomylib matplotlib folium mapclassify geopandas
Connect to a database¶
exposurelib supports two interchangeable ways to connect to the EU Building Database: a shared PostGIS database (via PostGISExposure) or a local SpatiaLite file (via SpatiaLiteExposure). Both expose the same query methods, so code written against one generally works against the other without changes.
from exposurelib import SpatiaLiteExposure
db = SpatiaLiteExposure('data/CDMX_2501_sample.db')
db.connect(init_spatial_metadata=False)
In production, keep connection details out of your code, for example in a config.yml, and connect with PostGISExposure(**config["postgis"]) against a shared server instead — see the Installation Manual for setting one up. If you are connecting to your own PostGIS instance, use the read-only consumer role for exploration unless you specifically intend to write to the database.
db.close()