Skip to content

Commit

Permalink
Merge pull request #433 from OpenHistoricalMap/imposm_transport
Browse files Browse the repository at this point in the history
Fix transport lines layer simplification
  • Loading branch information
Rub21 authored Dec 15, 2024
2 parents 07b4ce1 + 6eee24a commit 777ccae
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 278 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'
- 'transport_lines'
- 'imposm_transport'
jobs:
build:
runs-on: ubuntu-20.04
Expand Down
52 changes: 14 additions & 38 deletions images/tiler-imposm/config/layers/transport_lines.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,30 @@
]
},
"generalized_tables": {
"transport_lines_z5": {
"source": "transport_lines_z6",
"sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction') AND tunnel = 0 AND bridge = 0",
"tolerance": 1000
},
"transport_lines_z6": {
"source": "transport_lines_z7",
"sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link')",
"tolerance": 200
},
"transport_lines_z7": {
"source": "transport_lines_z8",
"sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'miniature', 'narrow_gauge', 'dismantled', 'abandoned', 'disused', 'razed', 'rail', 'light_rail', 'preserved', 'proposed')",
"transport_lines_z5_7": {
"source": "transport_lines_z8_9",
"sql_filter": null,
"tolerance": 150
},
"transport_lines_z8": {
"source": "transport_lines_z9",
"sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'miniature', 'narrow_gauge', 'dismantled', 'abandoned', 'disused', 'razed', 'rail', 'light_rail', 'preserved', 'proposed')",
"tolerance": 100
},
"transport_lines_z9": {
"source": "transport_lines_z10",
"transport_lines_z8_9": {
"source": "transport_lines_z10_11",
"sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'miniature', 'narrow_gauge', 'dismantled', 'abandoned', 'disused', 'razed', 'rail', 'light_rail', 'preserved', 'proposed')",
"tolerance": 50
},
"transport_lines_z10": {
"source": "transport_lines_z11",
"sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'miniature', 'narrow_gauge', 'dismantled', 'abandoned', 'disused', 'razed', 'rail', 'light_rail', 'preserved', 'proposed')",
"tolerance": 20
},
"transport_lines_z11": {
"source": "transport_lines_z12",
"transport_lines_z10_11": {
"source": "transport_lines_z12_13",
"sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'miniature', 'narrow_gauge', 'dismantled', 'abandoned', 'disused', 'razed', 'rail', 'light_rail', 'preserved', 'proposed', 'type', 'tram', 'funicular', 'monorail')",
"tolerance": 15
},
"transport_lines_z12": {
"source": "transport_lines_z13_15",
"sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'miniature', 'narrow_gauge', 'dismantled', 'abandoned', 'disused', 'razed', 'rail', 'light_rail', 'preserved', 'proposed', 'tram', 'funicular', 'monorail', 'taxiway', 'runway', 'raceway', 'residential', 'service', 'unclassified')",
"tolerance": 10
},
"transport_lines_z13_15": {
"source": "transport_lines_z16_20",
"sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'miniature', 'narrow_gauge', 'dismantled', 'abandoned', 'disused', 'razed', 'rail', 'light_rail', 'preserved', 'proposed', 'tram', 'funicular', 'monorail', 'taxiway', 'runway', 'raceway', 'residential', 'service', 'unclassified')",
"transport_lines_z12_13": {
"source": "transport_lines_z14_20",
"sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'miniature', 'narrow_gauge', 'dismantled', 'abandoned', 'disused', 'razed', 'rail', 'light_rail', 'preserved', 'proposed', 'tram', 'funicular', 'monorail', 'taxiway', 'runway', 'raceway', 'residential', 'service', 'unclassified') OR class IN ('railway', 'route')",
"tolerance": 5
},
"transport_lines_z16_20": {
"transport_lines_z14_20": {
"source": "transport_lines",
"sql_filter": "(type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'miniature', 'narrow_gauge', 'dismantled', 'abandoned', 'disused', 'razed', 'rail', 'light_rail', 'preserved', 'proposed', 'tram', 'funicular', 'monorail', 'taxiway', 'runway', 'raceway', 'residential', 'service', 'unclassified', 'subway', 'track', 'living_street', 'footway', 'cycleway', 'path', 'pier', 'steps', 'pedestrian', 'ferry') OR class IN ('railway', 'route'))"
"sql_filter": null,
"tolerance": 0
}
},
"tables": {
Expand Down Expand Up @@ -218,4 +194,4 @@
}
}
}
}
}
10 changes: 5 additions & 5 deletions images/tiler-imposm/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ INIT_FILE=/mnt/data/init_done

PG_CONNECTION="postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB"

mkdir -p "$CACHE_DIR" "$DIFF_DIR" "$IMPOSM3_EXPIRE_DIR"

# tracking file
TRACKING_FILE="$WORKDIR/uploaded_files.log"
TRACKING_FILE="$WORKDIR/uploaded_files.log"
[ -f "$TRACKING_FILE" ] || touch "$TRACKING_FILE"


mkdir -p "$CACHE_DIR" "$DIFF_DIR" "$IMPOSM3_EXPIRE_DIR"

# Create config map for imposm
python build_imposm3_config.py

Expand All @@ -33,7 +33,7 @@ python build_imposm3_config.py
echo "\"cachedir\": \"$CACHE_DIR\","
echo "\"diffdir\": \"$DIFF_DIR\","
echo "\"connection\": \"postgis://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB\","
echo "\"mapping\": \"config/imposm3.json\","
echo "\"mapping\": \"/osm/config/imposm3.json\","
echo "\"replication_url\": \"$REPLICATION_URL\""
echo "}"
} >"$WORKDIR/config.json"
Expand Down Expand Up @@ -123,7 +123,7 @@ function updateData() {

# Check if the limit file exists
if [ -z "$TILER_IMPORT_LIMIT" ]; then
imposm run -config "$WORKDIR/config.json" -expiretiles-dir "$IMPOSM3_EXPIRE_DIR" &
imposm run -config "$WORKDIR/config.json" -expiretiles-dir "$IMPOSM3_EXPIRE_DIR" -httpprofile ":6060" &
else
imposm run -config "$WORKDIR/config.json" -limitto "$WORKDIR/$LIMITFILE" -expiretiles-dir "$IMPOSM3_EXPIRE_DIR" &
fi
Expand Down
177 changes: 10 additions & 167 deletions images/tiler-server/config/providers/transport_lines.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[providers.layers]]
name = "transport_lines_z5"
name = "transport_lines_z5_7"
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
Expand All @@ -22,13 +22,13 @@ SELECT
isodatetodecimaldate(pad_date(end_date, 'end'), FALSE) AS end_decdate,
{{LENGUAGES}}
FROM
osm_transport_lines_z5
osm_transport_lines_z5_7
WHERE
geometry && !BBOX!
"""

[[providers.layers]]
name = "transport_lines_z6"
name = "transport_lines_z8_9"
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
Expand All @@ -50,13 +50,13 @@ SELECT
isodatetodecimaldate(pad_date(end_date, 'end'), FALSE) AS end_decdate,
{{LENGUAGES}}
FROM
osm_transport_lines_z6
osm_transport_lines_z8_9
WHERE
geometry && !BBOX!
"""

[[providers.layers]]
name = "transport_lines_z7"
name = "transport_lines_z10_11"
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
Expand All @@ -78,13 +78,13 @@ SELECT
isodatetodecimaldate(pad_date(end_date, 'end'), FALSE) AS end_decdate,
{{LENGUAGES}}
FROM
osm_transport_lines_z7
osm_transport_lines_z10_11
WHERE
geometry && !BBOX!
"""

[[providers.layers]]
name = "transport_lines_z8"
name = "transport_lines_z12_13"
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
Expand All @@ -106,13 +106,13 @@ SELECT
isodatetodecimaldate(pad_date(end_date, 'end'), FALSE) AS end_decdate,
{{LENGUAGES}}
FROM
osm_transport_lines_z8
osm_transport_lines_z12_13
WHERE
geometry && !BBOX!
"""

[[providers.layers]]
name = "transport_lines_z9"
name = "transport_lines_z14_20"
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
Expand All @@ -134,164 +134,7 @@ SELECT
isodatetodecimaldate(pad_date(end_date, 'end'), FALSE) AS end_decdate,
{{LENGUAGES}}
FROM
osm_transport_lines_z9
WHERE
geometry && !BBOX!
"""

[[providers.layers]]
name = "transport_lines_z10"
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
sql = """
SELECT
ST_AsMVTGeom(geometry, !BBOX!) AS geometry,
ABS(osm_id) AS osm_id,
ref,
class,
type,
service,
name,
electrified,
highspeed,
usage,
start_date,
end_date,
isodatetodecimaldate(pad_date(start_date, 'start'), FALSE) AS start_decdate,
isodatetodecimaldate(pad_date(end_date, 'end'), FALSE) AS end_decdate,
{{LENGUAGES}}
FROM
osm_transport_lines_z10
WHERE
geometry && !BBOX!
"""


[[providers.layers]]
name = "transport_lines_z11"
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
sql = """
SELECT
ST_AsMVTGeom(geometry, !BBOX!) AS geometry,
ABS(osm_id) AS osm_id,
name,
ref,
class,
type,
tunnel,
bridge,
access,
service,
ford,
electrified,
highspeed,
usage,
start_date,
end_date,
isodatetodecimaldate(pad_date(start_date, 'start'), FALSE) AS start_decdate,
isodatetodecimaldate(pad_date(end_date, 'end'), FALSE) AS end_decdate,
{{LENGUAGES}}
FROM
osm_transport_lines_z11
WHERE
geometry && !BBOX!
"""

[[providers.layers]]
name = "transport_lines_z12"
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
sql = """
SELECT
ST_AsMVTGeom(geometry, !BBOX!) AS geometry,
ABS(osm_id) AS osm_id,
name,
ref,
class,
type,
tunnel,
bridge,
access,
service,
ford,
electrified,
highspeed,
usage,
start_date,
end_date,
isodatetodecimaldate(pad_date(start_date, 'start'), FALSE) AS start_decdate,
isodatetodecimaldate(pad_date(end_date, 'end'), FALSE) AS end_decdate,
{{LENGUAGES}}
FROM
osm_transport_lines_z12
WHERE
geometry && !BBOX!
"""

[[providers.layers]]
name = "transport_lines_z13_15"
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
sql = """
SELECT
ST_AsMVTGeom(geometry, !BBOX!) AS geometry,
ABS(osm_id) AS osm_id,
name,
ref,
class,
type,
tunnel,
bridge,
access,
service,
ford,
electrified,
highspeed,
usage,
start_date,
end_date,
isodatetodecimaldate(pad_date(start_date, 'start'), FALSE) AS start_decdate,
isodatetodecimaldate(pad_date(end_date, 'end'), FALSE) AS end_decdate,
{{LENGUAGES}}
FROM
osm_transport_lines_z13_15
WHERE
geometry && !BBOX!
"""

[[providers.layers]]
name = "transport_lines_z16_20"
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
sql = """
SELECT
ST_AsMVTGeom(geometry, !BBOX!) AS geometry,
ABS(osm_id) AS osm_id,
name,
ref,
class,
type,
tunnel,
bridge,
access,
service,
ford,
electrified,
highspeed,
usage,
start_date,
end_date,
isodatetodecimaldate(pad_date(start_date, 'start'), FALSE) AS start_decdate,
isodatetodecimaldate(pad_date(end_date, 'end'), FALSE) AS end_decdate,
{{LENGUAGES}}
FROM
osm_transport_lines_z16_20
osm_transport_lines_z14_20
WHERE
geometry && !BBOX!
"""
Loading

0 comments on commit 777ccae

Please sign in to comment.