Commit 95380f59 authored by Cecilia Nievas's avatar Cecilia Nievas
Browse files

Added SQL script to create data_unit_tiles table

parent d6d957e3
Pipeline #29487 passed with stage
in 1 minute and 29 seconds
......@@ -33,6 +33,27 @@ Created and managed by [inyuu](https://git.gfz-potsdam.de/dynamicexposure/openbu
| hash | varchar(60) |
| executed_at | timestamp |
#### `data_unit_tiles` - Information about data-unit tiles
Data-unit tiles result from the intersection of data units with zoom level 18 quadtiles. Data
units are the smallest geographical unit where an exposure model is defined, i.e. where data is
available from an input aggregated exposure model for a particular occupancy case. Consequently,
the primary key of this table consists of four fields: `quadkey`, `aggregated_source_id`,
`occupancy_case` and `data_unit_id`.
| column name | data type | description |
|-----------------------------------|-----------|-----------------------------------------------------------------------|
| quadkey | char(18) | Zoom level 18 tile identifier. |
| aggregated_source_id | smallint | Identifier of the source of the aggregated model. |
| occupancy_case | varchar | E.g. residential, commercial, industrial, ... |
| exposure_entity | char(3) | Identifier of the exposure entity. If a country, ISO3 code. |
| data_unit_id | varchar | Identifier of the data unit. |
| size_data_unit_tile_area | float | Area of the data-unit tile, in m2. |
| size_data_unit_tile_built_up_area | float | Built-up area within the data-unit tile, in m2. |
| fraction_data_unit_area | float | `size_data_unit_tile_area` / area of the data unit. |
| fraction_data_unit_built_up_area | float | `size_data_unit_tile_built_up_area` / built-up area of the data unit. |
## More information
* [Database versioning best practices](https://enterprisecraftsmanship.com/posts/database-versioning-best-practices/)
CREATE TYPE occupancycase AS ENUM ('residential', 'commercial', 'industrial');
CREATE TABLE public.data_unit_tiles
(
quadkey char(18),
aggregated_source_id SMALLINT,
occupancy_case occupancycase,
exposure_entity char(3),
data_unit_id varchar,
size_data_unit_tile_area FLOAT,
size_data_unit_tile_built_up_area FLOAT,
fraction_data_unit_area FLOAT,
fraction_data_unit_built_up_area FLOAT,
PRIMARY KEY (quadkey, aggregated_source_id, occupancy_case, data_unit_id)
);
ALTER TABLE public.data_unit_tiles
OWNER TO postgres;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment