-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into resolve-kontur-mr-conflicts
- Loading branch information
Showing
3 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM postgis/postgis:14-3.3 | ||
|
||
COPY schema.sql /docker-entrypoint-initdb.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
CREATE EXTENSION btree_gist; | ||
|
||
-- STEP1 create table layers | ||
DROP TABLE IF EXISTS layers; | ||
CREATE TABLE layers ( | ||
id int4 NOT NULL GENERATED ALWAYS AS IDENTITY, | ||
public_id text NOT NULL, | ||
"name" text NULL, | ||
url text NULL, | ||
"type" text NULL, | ||
description text NULL, | ||
copyrights text NULL, | ||
last_updated timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
source_updated timestamptz NULL, | ||
access_time timestamptz NULL, | ||
"owner" text NULL, | ||
is_public bool NULL, | ||
category_id int4 NULL, | ||
group_id int4 NULL, | ||
properties jsonb NULL, | ||
is_dirty bool NULL, | ||
zoom_visibility_rules jsonb NULL, | ||
geom geometry NULL, | ||
is_visible bool NULL DEFAULT false, | ||
feature_properties jsonb NULL, | ||
api_key varchar NULL, | ||
is_global bool NULL DEFAULT false, | ||
tile_size int4 NULL, | ||
min_zoom int4 NULL, | ||
max_zoom int4 NULL, | ||
mapbox_styles jsonb NULL, | ||
CONSTRAINT layers_mapbox_styles_check CHECK ((mapbox_styles ? 'url'::text)), | ||
CONSTRAINT layers_pkey PRIMARY KEY (id), | ||
CONSTRAINT layers_public_id_key UNIQUE (public_id) | ||
); | ||
CREATE INDEX layers_geom_idx ON layers USING gist (geom); | ||
|
||
|
||
-- STEP2 populate table layers with feature for openaerialmap | ||
insert into layers( | ||
public_id, | ||
name, | ||
url, | ||
type, | ||
description, | ||
copyrights, | ||
last_updated, | ||
source_updated, | ||
owner, | ||
is_public, | ||
is_visible, | ||
is_global, | ||
geom) | ||
select | ||
'openaerialmap_geocint', | ||
'OAM Mosaic', | ||
-- (case '<stage>' when 'dev' then 'https://test-apps02.konturlabs.com/raster-tiler/oam/mosaic/{z}/{x}/{y}.png' | ||
-- when 'test' then 'https://test-apps.konturlabs.com/raster-tiler/oam/mosaic/{z}/{x}/{y}.png' | ||
-- else 'https://apps.kontur.io/raster-tiler/oam/mosaic/{z}/{x}/{y}.png' | ||
-- end), | ||
'', | ||
'raster', | ||
'The open collection of openly licensed satellite and unmanned aerial vehicle (UAV) imagery. ', | ||
'All imagery is publicly licensed and made available through the Humanitarian OpenStreetMap Team''s Open Imagery Network (OIN) Node. All imagery contained in OIN is licensed CC-BY 4.0, with attribution as contributors of Open Imagery Network. All imagery is available to be traced in OpenStreetMap. © OpenAerialMap, © Kontur', | ||
now(), | ||
now(), | ||
'layers-db', | ||
true, | ||
false, | ||
true, | ||
(select st_setsrid(ST_MakeBox2D(st_point(-179.0, -85.06), st_point(179.0, 85.06)),4326)); | ||
|
||
|
||
-- STEP3 creating table layers_features | ||
DROP TABLE IF EXISTS layers_features; | ||
CREATE TABLE layers_features ( | ||
feature_id text NOT NULL, | ||
layer_id int4 NOT NULL, | ||
properties jsonb NULL, | ||
geom geometry NULL, | ||
last_updated timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
zoom int4 NULL DEFAULT 999, | ||
CONSTRAINT layers_features_feature_id_layer_id_zoom_key UNIQUE (feature_id, layer_id, zoom) | ||
); | ||
CREATE INDEX layers_features_3857_idx ON layers_features USING gist (st_transform(geom, 3857)); | ||
CREATE INDEX layers_features_layer_id_3857_idx ON layers_features USING gist (layer_id, st_transform(geom, 3857)); | ||
CREATE INDEX layers_features_layer_id_geom_idx ON layers_features USING gist (layer_id, geom); | ||
CREATE INDEX layers_features_layer_id_zoom_geom_idx ON layers_features USING gist (layer_id, zoom, geom); | ||
CREATE INDEX layers_features_zoom_idx ON layers_features USING btree (zoom); | ||
|
||
ALTER TABLE layers_features ADD CONSTRAINT layers_features_layer_id_fkey FOREIGN KEY (layer_id) REFERENCES layers(id) ON DELETE CASCADE; |