Introduce a new database schema
We are creating a new database schema:
- using schemas instead of different databases
- including all data sources
- Created tables: sources, entities, taxonomies, assets, metadata, baseline_assets, district_assets
- Added primary and foreign key constraints
- Defined unique and partial indexes for optimized queries
- Needed functions:
- upsert_tile(): Adds a tile entity if it does not exist
- calculate_completeness(): Computes completeness of a tile based on built area
- update_completeness(): Updates completeness of intersecting tiles
- update_tile(): Executes upsert and completeness updates via a trigger
- Created
trigger_update_tileto automatically update tile completeness on entity insert/update - Created tables under
sourcesschema:- google_buildings: Stores Google building footprints with confidence scores
- microsoft_buildings: Stores Microsoft building footprints with height and quadkey reference
- boundaries: Stores geographical boundary data
- ghsl_characteristics: Stores GHSL-based characteristics
- Added indexes for spatial queries:
- GIST indexes on
geometrycolumns for efficient geospatial lookups - Index on
plus_codeingoogle_buildings
- GIST indexes on
Edited by Lars Lingner