Skip to content
Snippets Groups Projects
Commit 4dd887d0 authored by Laurens Oostwegel's avatar Laurens Oostwegel
Browse files

Add table 'obm_buildings' and change 'storeys' to 'height' in all building tables

parent 7502c2df
No related branches found
No related tags found
1 merge request!45Resolve "Translate `storeys` to the `height` tag from the GEM Taxonomy"
Pipeline #75480 passed
-- Copyright (c) 2024:
-- Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ
--
-- This program is free software: you can redistribute it and/or modify it
-- under the terms of the GNU Affero General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or (at
-- your option) any later version.
--
-- This program is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
-- General Public License for more details.
--
-- You should have received a copy of the GNU Affero General Public License
-- along with this program. If not, see http://www.gnu.org/licenses/.
-- Create table `obm_buildings`.
CREATE TABLE public.obm_buildings
(
id bigint PRIMARY KEY,
geometry public.GEOMETRY (GEOMETRY, 4326),
floorspace double precision,
occupancy text,
height text,
relation_id integer,
quadkey text,
last_update timestamp
);
-- Add index on `geometry`.
CREATE INDEX obmbuildings_geom_idx
ON public.obm_buildings USING gist (geometry);
-- Add index on `last_update`.
CREATE INDEX obmbuildings_lastupdate_idx
ON public.obm_buildings USING btree (last_update);
-- Add index on `quadkey`.
CREATE INDEX obmbuildings_quadkey_idx
ON public.obm_buildings USING btree (quadkey);
-- Create trigger to set the `last_update` timestamp.
CREATE TRIGGER set_timestamp BEFORE UPDATE
ON public.obm_buildings
FOR EACH ROW EXECUTE FUNCTION public.trigger_set_timestamp();
-- Drop column storeys and add column height to the `microsoft_buildings` table.
ALTER TABLE public.microsoft_buildings
DROP COLUMN storeys,
ADD COLUMN height text;
-- Drop column storeys and add column height to the `google_buildings` table.
ALTER TABLE public.google_buildings
DROP COLUMN storeys,
ADD COLUMN height text;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment