# A Spatio-Temporal Building Exposure Database and Information Life-Cycle Management Solution
## 3 Database Model
### Multi-Resolution Spatial Support  
Comprehensive spatial support to the database is provided by the PostGIS extension to PostgreSQL. A particular requirement for the database, however, was the support of multiple object representations. Due to the focus on geographical objects derived from imaging techniques and mapping approaches, multi-representation can be seen in terms of multi-resolution or multi-scale datasets, where different generalization levels of the objects are provided. However, also multiple representations of datasets at the same resolution are possible when, for example, data from different sources are integrated (e.g., building footprints from cadastral maps together with footprints extracted by satellite image analysis).  
In the current implementation of the database, a bottom-up approach is followed where datasets of different resolution are linked by additional attributes, which refer to the corresponding objects in the lower levels of detail. A trigger function _object.update_resolution_ids()_ has been implemented to identify for each object at each resolution level its corresponding representations at the other resolution levels and to update the resolution IDs based on the spatial relationship between the geometries. More specifically, the function identifies for each object with a given polygon geometry type a point inside the polygon that is closest to its centroid and, based on this, performs a spatial join with the polygon geometries at the other resolution levels to obtain their corresponding IDs. The function is called from a row level after the INSERT or UPDATE trigger of the geometry column (_the_geom_) and, therefore, updates the IDs on the fly whenever the geometry of any record at any resolution level is modified or a new record is inserted. A row level after DELETE trigger handles the ID updates for record deletes. The resolution ID updates are only performed for records that are actually affected by the INSERT, UPDATE, or DELETE triggers. This is done to avoid affecting negatively the database performance by having to re-compute ID relations for the whole dataset.  
In its current implementation, the data model supports three resolution levels, based on the assumption that the database will be populated mostly with information derived from census reports, satellite image analysis, and in-situ screening techniques. The data model can be easily extended to other numbers of resolution levels, and level definitions are not fixed or bound to specific conditions but can be customized depending on the specific application.  
In order to derive new (lower resolution) data sets from existing (higher resolution) ones, a generalization function needs to be defined to describe this action. The choice of the generalization function depends upon the type of objects to be created and the desired resolution level. For example, a generalization function that derives aggregated building blocks from higher resolution building footprints may be different from a function that creates a built-up area footprint from a set of building blocks. To exemplify the capabilities of the data model, a simple prototype generalization function (_simplify_buildings()_) has been implemented for the geometrical simplification of building footprints to aggregated building blocks.