Skip to content

Commit

Permalink
Merge pull request #442 from OpenHistoricalMap/refactor/imposm
Browse files Browse the repository at this point in the history
Refactor script to create simplification tables - tiler
  • Loading branch information
Rub21 authored Dec 19, 2024
2 parents ddfc1d5 + 7fa9bfd commit b7e144c
Show file tree
Hide file tree
Showing 11 changed files with 502 additions and 372 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/chartpress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- 'main'
- 'staging'
- 'development'
- 'imposm_transport'
- 'refactor/imposm'
jobs:
build:
runs-on: ubuntu-20.04
Expand Down
65 changes: 38 additions & 27 deletions compose/tiler.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
services:
db:
image: ohm-tiler-db:v1
build:
context: ../images/tiler-db
dockerfile: Dockerfile
ports:
- "5432:5432"
volumes:
- ../data/tiler-db-data2:/var/lib/postgresql/data
env_file:
- ../envs/.env.tiler
restart: always
imposm:
image: rub21/tiler-imposm:v15
build:
context: ../images/tiler-imposm
dockerfile: Dockerfile
volumes:
- ../data/tiler-imposm-data2:/mnt/data
- ../images/tiler-imposm:/app
command:
- sh
- -c
- "sleep 20 && ./start.sh"
env_file:
- ../envs/.env.tiler
# db:
# image: ohm-tiler-db:v1
# build:
# context: ../images/tiler-db
# dockerfile: Dockerfile
# ports:
# - "5432:5432"
# # volumes:
# # - ../data/tiler-db-data2:/var/lib/postgresql/data
# env_file:
# - ../envs/.env.tiler
# restart: always
# networks:
# - tiler_network

# imposm:
# image: rub21/tiler-imposm:v16
# build:
# context: ../images/tiler-imposm
# dockerfile: Dockerfile
# volumes:
# # - ../data/tiler-imposm-data2:/mnt/data
# - ../images/tiler-imposm:/osm
# command:
# - sh
# - -c
# - "./start.sh"
# env_file:
# - ../envs/.env.tiler
# networks:
# - tiler_network

tiler:
image: ohm-tiler-server:v1
build:
Expand All @@ -38,4 +44,9 @@ services:
env_file:
- ../envs/.env.tiler
restart: always

networks:
- tiler_network

networks:
tiler_network:
driver: bridge
164 changes: 96 additions & 68 deletions images/tiler-imposm/config/layers/admin_areas.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,95 +8,123 @@
]
},
"generalized_tables": {
"admin_boundaries_lines_z0_2": {
"admin_areas_z0_2": {
"source": "admin_areas",
"tolerance": 5000,
"geometry_transform": "ST_Boundary(geometry)",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2)"
},
"admin_boundaries_centroid_z0_2": {
"source": "admin_areas",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2) AND name IS NOT NULL AND name <> ''"
"sql_filter": "admin_level IN (1,2)",
"sub_tables": [
{
"table": "admin_boundaries_lines_z0_2",
"geometry_transform": "ST_Boundary(geometry)"
},
{
"table": "admin_boundaries_centroid_z0_2",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"sql_filter": "name IS NOT NULL AND name <> ''"
}
]
},
"admin_boundaries_lines_z3_5": {

"admin_areas_z3_5": {
"source": "admin_areas",
"tolerance": 1000,
"geometry_transform": "ST_Boundary(geometry)",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2,3,4)"
},
"admin_boundaries_centroid_z3_5": {
"source": "admin_areas",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2,3,4) AND name IS NOT NULL AND name <> ''"
"sql_filter": "admin_level IN (1,2,3,4)",
"sub_tables": [
{
"table": "admin_boundaries_lines_z3_5",
"geometry_transform": "ST_Boundary(geometry)"
},
{
"table": "admin_boundaries_centroid_z3_5",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"sql_filter": "name IS NOT NULL AND name <> ''"
}
]
},
"admin_boundaries_lines_z6_7": {

"admin_areas_z6_7": {
"source": "admin_areas",
"tolerance": 200,
"geometry_transform": "ST_Boundary(geometry)",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2,3,4,5,6)"
},
"admin_boundaries_centroid_z6_7": {
"source": "admin_areas",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2,3,4,5,6) AND name IS NOT NULL AND name <> ''"
"sql_filter": "admin_level IN (1,2,3,4,5,6)",
"sub_tables": [
{
"table": "admin_boundaries_lines_z6_7",
"geometry_transform": "ST_Boundary(geometry)"
},
{
"table": "admin_boundaries_centroid_z6_7",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"sql_filter": "name IS NOT NULL AND name <> ''"
}
]
},
"admin_boundaries_lines_z8_9": {

"admin_areas_z8_9": {
"source": "admin_areas",
"tolerance": 100,
"geometry_transform": "ST_Boundary(geometry)",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9)"
},
"admin_boundaries_centroid_z8_9": {
"source": "admin_areas",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9) AND name IS NOT NULL AND name <> ''"
"sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9)",
"sub_tables": [
{
"table": "admin_boundaries_lines_z8_9",
"geometry_transform": "ST_Boundary(geometry)"
},
{
"table": "admin_boundaries_centroid_z8_9",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"sql_filter": "name IS NOT NULL AND name <> ''"
}
]
},
"admin_boundaries_lines_z10_12": {

"admin_areas_z10_12": {
"source": "admin_areas",
"tolerance": 20,
"geometry_transform": "ST_Boundary(geometry)",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9,10)"
},
"admin_boundaries_centroid_z10_12": {
"source": "admin_areas",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9,10) AND name IS NOT NULL AND name <> ''"
"sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9,10)",
"sub_tables": [
{
"table": "admin_boundaries_lines_z10_12",
"geometry_transform": "ST_Boundary(geometry)"
},
{
"table": "admin_boundaries_centroid_z10_12",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"sql_filter": "name IS NOT NULL AND name <> ''"
}
]
},
"admin_boundaries_lines_z13_15": {

"admin_areas_z13_15": {
"source": "admin_areas",
"tolerance": 5,
"geometry_transform": "ST_Boundary(geometry)",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9,10)"
},
"admin_boundaries_centroid_z13_15": {
"source": "admin_areas",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9,10) AND name IS NOT NULL AND name <> ''"
"sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9,10)",
"sub_tables": [
{
"table": "admin_boundaries_lines_z13_15",
"geometry_transform": "ST_Boundary(geometry)"
},
{
"table": "admin_boundaries_centroid_z13_15",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"sql_filter": "name IS NOT NULL AND name <> ''"
}
]
},
"admin_boundaries_lines_z16_20": {
"admin_areas_z16_20": {
"source": "admin_areas",
"geometry_transform": "ST_Boundary(geometry)",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9,10)"
},
"admin_boundaries_centroid_z16_20": {
"source": "admin_areas",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"geometry_transform_types": "GeometryType(geometry) IN ('POLYGON', 'MULTIPOLYGON')",
"sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9,10) AND name IS NOT NULL AND name <> ''"
"sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9,10)",
"sub_tables": [
{
"table": "admin_boundaries_lines_z16_20",
"geometry_transform": "ST_Boundary(geometry)"
},
{
"table": "admin_boundaries_centroid_z16_20",
"geometry_transform": "(ST_MaximumInscribedCircle(geometry)).center",
"sql_filter": "name IS NOT NULL AND name <> ''"
}
]
}
},
"tables": {
Expand Down
27 changes: 6 additions & 21 deletions images/tiler-imposm/config/layers/admin_lines.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,18 @@
]
},
"generalized_tables": {
"admin_lines_z0_2": {
"source": "admin_lines",
"sql_filter": "maritime='yes'",
"tolerance": 5000
},
"admin_lines_z3_5": {
"source": "admin_lines",
"admin_lines_z0_5": {
"source": "admin_lines_z6_9",
"sql_filter": "maritime='yes'",
"tolerance": 2000
},
"admin_lines_z6_7": {
"source": "admin_lines",
"sql_filter": "maritime='yes'",
"tolerance": 1000
},
"admin_lines_z8_9": {
"source": "admin_lines",
"admin_lines_z6_9": {
"source": "admin_lines_z10_15",
"sql_filter": "maritime='yes'",
"tolerance": 500
},
"admin_lines_z10_12": {
"source": "admin_lines",
"sql_filter": "maritime='yes'",
"tolerance": 100
},
"admin_lines_z13_15": {
"source": "admin_lines",
"admin_lines_z10_15": {
"source": "admin_lines_z16_20",
"sql_filter": "maritime='yes'",
"tolerance": 10
},
Expand Down
Loading

0 comments on commit b7e144c

Please sign in to comment.