Skip to content

Commit

Permalink
Merge branch 'develop' into resolve-kontur-mr-conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dqunbp authored Sep 11, 2023
2 parents c6f965b + 3956151 commit 31f6181
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 1 deletion.
3 changes: 2 additions & 1 deletion catalog-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var analytics = require("./controllers/analytics");
var meta = require("./controllers/meta");
var Meta = require("./models/meta");
// Replace mongoose's deprecated promise library (mpromise) with bluebird

var mongoose = require("mongoose");
mongoose.Promise = require("bluebird");
var request = require("request");
Expand Down Expand Up @@ -288,4 +289,4 @@ if (isPgEnabled) {
console.warn(
"The Postgres credentials not defined, skip mosaic index updating"
);
}
}
3 changes: 3 additions & 0 deletions postgres/Dockerfile
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/
91 changes: 91 additions & 0 deletions postgres/schema.sql
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;

0 comments on commit 31f6181

Please sign in to comment.