Skip to content

Commit

Permalink
Simplification of waterlines according to zoom level.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Mar 25, 2024
1 parent da8824b commit b354009
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 11 deletions.
26 changes: 25 additions & 1 deletion images/tiler-server/config/config.template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,32 @@ center = [-74.275329586789, -12.153492567373, 8.0]
# Water Lines
[[maps.layers]]
name = "water_lines"
provider_layer = "osm.water_lines_gen0"
provider_layer = "osm.water_lines_gen0_5-5"
min_zoom = 5
max_zoom = 5

[[maps.layers]]
name = "water_lines"
provider_layer = "osm.water_lines_gen0_6-6"
min_zoom = 6
max_zoom = 6

[[maps.layers]]
name = "water_lines"
provider_layer = "osm.water_lines_gen0_7-7"
min_zoom = 7
max_zoom = 7

[[maps.layers]]
name = "water_lines"
provider_layer = "osm.water_lines_gen0_8-8"
min_zoom = 8
max_zoom = 8

[[maps.layers]]
name = "water_lines"
provider_layer = "osm.water_lines_gen0_9-9"
min_zoom = 9
max_zoom = 9

[[maps.layers]]
Expand Down
115 changes: 105 additions & 10 deletions images/tiler-server/config/providers/water_lines.toml
Original file line number Diff line number Diff line change
@@ -1,36 +1,82 @@
# Simplification for geometries

[[providers.layers]]
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "id"
name = "water_lines"
id_fieldname = "osm_id"
name = "water_lines_gen0_5-5"
sql = """
SELECT
ST_AsMVTGeom(geometry, !BBOX!) AS geometry,
id,
osm_id,
ST_AsMVTGeom(ST_Simplify(geometry, 2000), !BBOX!) AS geometry,
ABS(osm_id) AS osm_id,
name,
type,
tags->'bridge' AS bridge,
tags->'surface' AS surface,
tags->'start_date' AS start_date,
tags->'end_date' AS end_date,
isodatetodecimaldate(pad_date(tags->'start_date', 'start'), FALSE) AS start_decdate,
isodatetodecimaldate(pad_date(tags->'end_date', 'end'), FALSE) AS end_decdate
FROM
osm_water_lines
osm_water_lines_gen0
WHERE
type IN ('river', 'canal', 'stream', 'ditch', 'drain', 'dam', 'cliff')
type IN ('river', 'canal')
AND geometry && !BBOX!
"""

[[providers.layers]]
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
name = "water_lines_gen0"
name = "water_lines_gen0_6-6"
sql = """
SELECT
ST_AsMVTGeom(geometry, !BBOX!) AS geometry,
ST_AsMVTGeom(ST_Simplify(geometry, 1500), !BBOX!) AS geometry,
ABS(osm_id) AS osm_id,
name,
type,
tags->'bridge' AS bridge,
tags->'start_date' AS start_date,
tags->'end_date' AS end_date,
isodatetodecimaldate(pad_date(tags->'start_date', 'start'), FALSE) AS start_decdate,
isodatetodecimaldate(pad_date(tags->'end_date', 'end'), FALSE) AS end_decdate
FROM
osm_water_lines_gen0
WHERE
type IN ('river', 'canal')
AND geometry && !BBOX!
"""

[[providers.layers]]
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
name = "water_lines_gen0_7-7"
sql = """
SELECT
ST_AsMVTGeom(ST_Simplify(geometry, 1000), !BBOX!) AS geometry,
ABS(osm_id) AS osm_id,
name,
type,
tags->'bridge' AS bridge,
tags->'start_date' AS start_date,
tags->'end_date' AS end_date,
isodatetodecimaldate(pad_date(tags->'start_date', 'start'), FALSE) AS start_decdate,
isodatetodecimaldate(pad_date(tags->'end_date', 'end'), FALSE) AS end_decdate
FROM
osm_water_lines_gen0
WHERE
type IN ('river', 'canal')
AND geometry && !BBOX!
"""

[[providers.layers]]
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
name = "water_lines_gen0_8-8"
sql = """
SELECT
ST_AsMVTGeom(ST_Simplify(geometry, 500), !BBOX!) AS geometry,
ABS(osm_id) AS osm_id,
name,
type,
Expand All @@ -46,6 +92,30 @@ WHERE
AND geometry && !BBOX!
"""

[[providers.layers]]
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "osm_id"
name = "water_lines_gen0_9-9"
sql = """
SELECT
ST_AsMVTGeom(ST_Simplify(geometry, 100), !BBOX!) AS geometry,
ABS(osm_id) AS osm_id,
name,
type,
tags->'bridge' AS bridge,
tags->'start_date' AS start_date,
tags->'end_date' AS end_date,
isodatetodecimaldate(pad_date(tags->'start_date', 'start'), FALSE) AS start_decdate,
isodatetodecimaldate(pad_date(tags->'end_date', 'end'), FALSE) AS end_decdate
FROM
osm_water_lines_gen0
WHERE
type IN ('river', 'canal')
AND geometry && !BBOX!
"""


[[providers.layers]]
geometry_fieldname = "geometry"
geometry_type = "linestring"
Expand All @@ -69,3 +139,28 @@ WHERE
type IN ('river', 'canal', 'stream', 'ditch', 'drain', 'dam', 'cliff')
AND geometry && !BBOX!
"""

[[providers.layers]]
geometry_fieldname = "geometry"
geometry_type = "linestring"
id_fieldname = "id"
name = "water_lines"
sql = """
SELECT
ST_AsMVTGeom(geometry, !BBOX!) AS geometry,
id,
osm_id,
name,
type,
tags->'bridge' AS bridge,
tags->'surface' AS surface,
tags->'start_date' AS start_date,
tags->'end_date' AS end_date,
isodatetodecimaldate(pad_date(tags->'start_date', 'start'), FALSE) AS start_decdate,
isodatetodecimaldate(pad_date(tags->'end_date', 'end'), FALSE) AS end_decdate
FROM
osm_water_lines
WHERE
type IN ('river', 'canal', 'stream', 'ditch', 'drain', 'dam', 'cliff')
AND geometry && !BBOX!
"""

0 comments on commit b354009

Please sign in to comment.