Skip to content

Commit 2a1afa1

Browse files
authored
Vtiles attributes in admin layers (#718)
* Add border_type in admin/nod_admin polygon and centroids boundaries * Add other attributes for admin lines * Add border_type in admin areas * Add attributes for admin lines * Add attributes for admin lines * Remove border_type and indefinite from admin/no admin areas * Add subdomain config for martin tiler * Return empty when ther eis no values * Use NULLIF for all columns for area views * Recreate mviews on update * Fix issue with ferry #1303 * Optimize parallel query settings and add index to speed up admin boundaries mview creation * Update branch name to create docker image * Update Volume id and imposm docker for production
1 parent ef90c2d commit 2a1afa1

20 files changed

+286
-105
lines changed

.github/workflows/chartpress.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
branches:
55
- 'main'
66
- 'staging'
7-
- 'tiler_cache_paths'
7+
- 'vtiles_admin_attr'
88
jobs:
99
build:
1010
runs-on: ubuntu-22.04
@@ -71,7 +71,7 @@ jobs:
7171
OHM_SLACK_WEBHOOK_URL: ${{ secrets.OHM_SLACK_WEBHOOK_URL }}
7272
################ Staging secrets ################
7373
- name: Staging - substitute secrets
74-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/tiler_cache_paths'
74+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/vtiles_admin_attr'
7575
uses: bluwy/substitute-string-action@v1
7676
with:
7777
_input-file: 'values.staging.template.yaml'
@@ -189,14 +189,14 @@ jobs:
189189
PRODUCTION_OPENSTREETMAP_AUTH_SECRET: ${{ secrets.PRODUCTION_OPENSTREETMAP_AUTH_SECRET }}
190190

191191
- name: AWS Credentials
192-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/tiler_cache_paths'
192+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/vtiles_admin_attr'
193193
uses: aws-actions/configure-aws-credentials@v1
194194
with:
195195
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
196196
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
197197
aws-region: us-east-1
198198
- name: Setup Kubectl and Helm Dependencies
199-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/tiler_cache_paths'
199+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/vtiles_admin_attr'
200200
run: |
201201
sudo pip install awscli --ignore-installed six
202202
sudo curl -L -o /usr/bin/kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.17.7/2020-07-08/bin/linux/amd64/kubectl
@@ -210,22 +210,22 @@ jobs:
210210
helm version
211211
212212
- name: Update kube-config staging
213-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/tiler_cache_paths'
213+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/vtiles_admin_attr'
214214
run: aws eks --region us-east-1 update-kubeconfig --name osmseed-staging
215215
- name: Update kube-config prod
216216
if: github.ref == 'refs/heads/main'
217217
run: aws eks --region us-east-1 update-kubeconfig --name osmseed-production-v2
218218
- name: Add Helm repository
219-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/tiler_cache_paths'
219+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/vtiles_admin_attr'
220220
run: |
221221
helm repo add osm-seed https://osm-seed.github.io/osm-seed-chart/
222222
helm repo update
223223
- name: Install helm dependencies for
224-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/tiler_cache_paths'
224+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/vtiles_admin_attr'
225225
run: cd ohm && helm dep up
226226
# Staging
227227
- name: Staging - helm deploy
228-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/tiler_cache_paths'
228+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/vtiles_admin_attr'
229229
run: helm upgrade --install staging --wait ohm/ -f values.staging.yaml -f ohm/values.yaml
230230
# Production
231231
- name: Production - helm deploy

compose/tiler.yml

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ services:
99
- "54321:5432"
1010
volumes:
1111
- tiler_pgdata:/var/lib/postgresql/data
12+
- ../hetzner/tiler/config/postgresql.staging.conf:/etc/postgresql/postgresql.conf
13+
environment:
14+
- POSTGRES_CONFIG_FILE=/etc/postgresql/postgresql.conf
15+
command:
16+
- postgres
17+
- "-c"
18+
- "config_file=/etc/postgresql/postgresql.conf"
1219
env_file:
1320
- ../envs/.env.tiler
1421
restart: always
@@ -33,22 +40,22 @@ services:
3340
networks:
3441
- ohm_network
3542

36-
tiler:
37-
image: rub21/tiler-server:v1
38-
container_name: tiler
39-
build:
40-
context: ../images/tiler-server
41-
dockerfile: Dockerfile
42-
volumes:
43-
- ../hetzner:/hetzner
44-
- ../images/tiler-server:/app
45-
ports:
46-
- "9090:9090"
47-
env_file:
48-
- ../envs/.env.tiler
49-
restart: always
50-
networks:
51-
- ohm_network
43+
# tiler:
44+
# image: rub21/tiler-server:v1
45+
# container_name: tiler
46+
# build:
47+
# context: ../images/tiler-server
48+
# dockerfile: Dockerfile
49+
# volumes:
50+
# - ../hetzner:/hetzner
51+
# - ../images/tiler-server:/app
52+
# ports:
53+
# - "9090:9090"
54+
# env_file:
55+
# - ../envs/.env.tiler
56+
# restart: always
57+
# networks:
58+
# - ohm_network
5259

5360
# tiler-cache:
5461
# image: rub21/tiler-cache:v2

hetzner/tiler/config/postgresql.production.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ autovacuum_vacuum_cost_limit = -1 # Let PostgreSQL adjust vacuum cost d
4040
# QUERY TUNING
4141
#------------------------------------------------------------------------------
4242
effective_io_concurrency = 300 # For SSD; helps the planner estimate IO concurrency
43-
parallel_tuple_cost = 0.1 # Lower cost to encourage parallelization
44-
parallel_setup_cost = 500 # Lower to encourage more parallel plans
43+
parallel_tuple_cost = 0.001 # Lower cost to encourage parallelization
44+
parallel_setup_cost = 100 # Lower to encourage more parallel plans
4545
max_worker_processes = 28 # Allow up to 28 worker processes
4646
max_parallel_workers_per_gather = 8 # Max workers that can help a single query
4747
max_parallel_workers = 28 # Total number of parallel workers across all queries

hetzner/tiler/config/postgresql.staging.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ autovacuum_vacuum_cost_limit = -1 # Allow PostgreSQL to auto-adjust vacuu
4444
#------------------------------------------------------------------------------
4545

4646
effective_io_concurrency = 100 # Reduce IO concurrency to fit within staging constraints
47-
parallel_tuple_cost = 0.1 # Encourage parallel execution
48-
parallel_setup_cost = 200 # Lower parallel setup cost
47+
parallel_tuple_cost = 0.001 # Encourage parallel execution
48+
parallel_setup_cost = 100 # Lower parallel setup cost
4949
max_worker_processes = 4 # Limit worker processes to available CPU cores
50-
max_parallel_workers_per_gather = 2 # Limit per-query parallel workers
50+
max_parallel_workers_per_gather = 4 # Allow more per-query parallel workers
5151
max_parallel_workers = 4 # Total parallel workers for staging
5252

5353
#------------------------------------------------------------------------------

hetzner/tiler/tiler.production.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ services:
1616

1717
tiler_imposm:
1818
container_name: tiler_imposm
19-
image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3309.h529b5183
19+
image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3325.hb9f97989
2020
volumes:
2121
- tiler_imposm_data:/mnt/data
2222
env_file:
@@ -136,10 +136,10 @@ services:
136136
volumes:
137137
tiler_pgdata:
138138
driver: local
139-
name: tiler_db_25_02
139+
name: tiler_db_10_03
140140
tiler_imposm_data:
141141
driver: local
142-
name: tiler_imposm_25_02
142+
name: tiler_imposm_10_03
143143

144144
networks:
145145
ohm_network:

hetzner/traefik/traefik.template.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ http:
137137
middlewares:
138138
- secure-headers
139139

140+
martin-router:
141+
rule: Host(`martin.{{OHM_DOMAIN}}`)
142+
entryPoints:
143+
- port-web
144+
service: martin
145+
middlewares:
146+
- secure-headers
147+
140148
node-exporter-router:
141149
rule: Host(`node-exporter.{{OHM_DOMAIN}}`)
142150
entryPoints:
@@ -184,6 +192,11 @@ http:
184192
servers:
185193
- url: http://taginfo_web:4567
186194

195+
martin:
196+
loadBalancer:
197+
servers:
198+
- url: http://martin:80
199+
187200
node_exporter:
188201
loadBalancer:
189202
servers:

images/tiler-imposm/config/layers/admin_areas.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@
5656
"name": "area",
5757
"key": null
5858
},
59+
{
60+
"type": "string",
61+
"name": "border_type",
62+
"key": "border_type"
63+
},
64+
{
65+
"type": "string",
66+
"name": "indefinite",
67+
"key": "indefinite"
68+
},
69+
{
70+
"type": "string",
71+
"name": "disputed",
72+
"key": "disputed"
73+
},
74+
{
75+
"type": "string",
76+
"name": "disputed_by",
77+
"key": "disputed_by"
78+
},
5979
{
6080
"type": "hstore_tags",
6181
"name": "tags",

images/tiler-imposm/config/layers/admin_lines.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@
4141
"name": "maritime",
4242
"key": "maritime"
4343
},
44+
{
45+
"type": "string",
46+
"name": "indefinite",
47+
"key": "indefinite"
48+
},
49+
{
50+
"type": "string",
51+
"name": "disputed",
52+
"key": "disputed"
53+
},
54+
{
55+
"type": "string",
56+
"name": "disputed_by",
57+
"key": "disputed_by"
58+
},
4459
{
4560
"type": "boolint",
4661
"name": "has_label",

images/tiler-imposm/config/layers/admin_relation_members.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@
7070
"key": "maritime",
7171
"from_member": true
7272
},
73+
{
74+
"name": "me_indefinite",
75+
"type": "string",
76+
"key": "indefinite",
77+
"from_member": true
78+
},
79+
{
80+
"name": "me_disputed",
81+
"type": "string",
82+
"key": "disputed",
83+
"from_member": true
84+
},
85+
{
86+
"name": "me_disputed_by",
87+
"type": "string",
88+
"key": "disputed_by",
89+
"from_member": true
90+
},
7391
{
7492
"type": "hstore_tags",
7593
"name": "me_tags",

images/tiler-imposm/queries/ohm_mviews/admin_boundaries_areas.sql

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
-- ============================================================================
22
-- Create materialized views for admin boundaries areas
33
-- ============================================================================
4+
5+
-- Index on admin_level to speed up filtering
6+
CREATE INDEX IF NOT EXISTS idx_osm_admin_areas_admin_level
7+
ON osm_admin_areas (admin_level) WHERE geometry IS NOT NULL;
8+
9+
-- Enable parallel workers on source table
10+
ALTER TABLE osm_admin_areas SET (parallel_workers = 4);
11+
412
DROP MATERIALIZED VIEW IF EXISTS mv_admin_boundaries_areas_z16_20 CASCADE;
513

6-
SELECT create_areas_mview( 'osm_admin_areas', 'mv_admin_boundaries_areas_z16_20', 1, 0, 'id, osm_id, type', 'admin_level IN (1,2,3,4,5,6,7,8,9,10,11)');
14+
SELECT create_areas_mview( 'osm_admin_areas', 'mv_admin_boundaries_areas_z16_20', 1, 0, 'id, osm_id, type', 'admin_level IN (1,2,3,4,5,6,7,8,9,10,11)', NULL);
715
SELECT create_area_mview_from_mview('mv_admin_boundaries_areas_z16_20','mv_admin_boundaries_areas_z13_15', 5, 0.0, NULL);
816
SELECT create_area_mview_from_mview('mv_admin_boundaries_areas_z13_15','mv_admin_boundaries_areas_z10_12', 20, 0.0, 'admin_level IN (1,2,3,4,5,6,7,8,9,10)');
917
SELECT create_area_mview_from_mview('mv_admin_boundaries_areas_z10_12','mv_admin_boundaries_areas_z8_9', 100, 0.0, 'admin_level IN (1,2,3,4,5,6,7,8,9)');

0 commit comments

Comments
 (0)