Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ ohm/charts/
k3s.sh
*.zip
test-preview.sh
values.k3s.preview.yaml
values.k3s.preview.yaml
tiler-preview.sh
12 changes: 12 additions & 0 deletions images/tiler-imposm/config/layers/landuse_areas.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@
"exclude": [
"water"
]
},
"golf": {
"mapping": {
"golf": [
"green",
"bunker",
"fairway",
"rough",
"tee",
"driving_range"
]
}
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions images/tiler-imposm/config/layers/landuse_points.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@
"__any__"
]
}
},
"golf": {
"mapping": {
"golf": [
"pin",
"hole",
"tee"
]
}
}
}
}
Expand Down
63 changes: 63 additions & 0 deletions images/tiler-imposm/config/layers/natural_lines.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"tags": {
"load_all": true,
"exclude": [
"created_by",
"source",
"source:datetime"
]
},
"generalized_tables": {},
"tables": {
"natural_lines": {
"fields": [
{
"type": "id",
"name": "osm_id",
"key": null
},
{
"type": "geometry",
"name": "geometry",
"key": null
},
{
"type": "string",
"name": "name",
"key": "name"
},
{
"type": "mapping_value",
"name": "type",
"key": null
},
{
"type": "mapping_key",
"name": "class",
"key": null
},
{
"type": "string",
"name": "start_date",
"key": "start_date"
},
{
"type": "string",
"name": "end_date",
"key": "end_date"
},
{
"type": "hstore_tags",
"name": "tags",
"key": null
}
],
"type": "linestring",
"mapping": {
"natural": [
"cliff"
]
}
}
}
}
3 changes: 0 additions & 3 deletions images/tiler-imposm/config/layers/water_lines.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@
],
"barrier": [
"ditch"
],
"natural": [
"cliff"
]
}
}
Expand Down
6 changes: 4 additions & 2 deletions images/tiler-imposm/queries/ohm_mviews/buildings.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ SELECT create_points_mview(
'FALSE::boolean AS hide_3d',
'NULL::text AS roof_material',
'NULL::text AS roof_colour',
'NULL::text AS roof_shape'
'NULL::text AS roof_shape',
'NULLIF(tags->''golf'', '''') AS golf'
],
NULL
);
Expand All @@ -54,7 +55,8 @@ SELECT create_areas_mview(
'(class = ''building:part'') AS is_building_part,
EXISTS (SELECT 1 FROM osm_buildings_relation_members obrm WHERE obrm.member = ABS(osm_buildings.osm_id) AND obrm.role = ''outline'') AS hide_3d,
render_height(height, building_height, building_levels) AS render_height,
render_min_height(min_height, building_min_level) AS render_min_height',
render_min_height(min_height, building_min_level) AS render_min_height,
NULLIF(tags->''golf'', '''') AS golf',
'{"roof_height": "parse_to_meters(roof_height)"}'::jsonb,
ARRAY['height', 'min_height', 'building_height', 'building_levels', 'building_min_level']
);
Expand Down
18 changes: 18 additions & 0 deletions images/tiler-imposm/queries/ohm_mviews/natural_lines.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- ============================================================================
-- Natural Lines Materialized Views for Multiple Zoom Levels
-- Natural line features (natural=cliff, ...) split out of water_lines so they
-- are not tied to the water layer (issue #1345). Source table: osm_natural_lines.
-- The base type filter is kept explicit so new natural line types can be added
-- to the import without automatically showing up at every zoom.
-- ============================================================================

DROP MATERIALIZED VIEW IF EXISTS mv_natural_lines_z16_20 CASCADE;

SELECT create_lines_mview('osm_natural_lines', 'mv_natural_lines_z16_20', 0, 0, 'id, osm_id, type', 'type IN (''cliff'')');
SELECT create_mview_line_from_mview('mv_natural_lines_z16_20', 'mv_natural_lines_z13_15', 5, 'type IN (''cliff'')');
SELECT create_mview_line_from_mview('mv_natural_lines_z13_15', 'mv_natural_lines_z10_12', 20, 'type IN (''cliff'')');

-- Refresh lines views
-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_natural_lines_z16_20;
-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_natural_lines_z13_15;
-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_natural_lines_z10_12;
4 changes: 2 additions & 2 deletions images/tiler-imposm/queries/ohm_mviews/places.sql
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ SELECT create_place_points_centroids_mview (

SELECT create_place_points_centroids_mview (
'mv_place_points_centroids_z11_20',
ARRAY ['plot', 'square', 'islet'],
ARRAY ['plot', 'square', 'islet', 'island'],
ARRAY ['state', 'province', 'region', 'county', 'municipality', 'city', 'town', 'village', 'suburb', 'locality', 'hamlet', 'islet', 'neighbourhood', 'district', 'borough', 'quarter', 'isolated_dwelling', 'farm']
);

Expand All @@ -204,7 +204,7 @@ SELECT create_place_points_centroids_mview (
-- ============================================================================
SELECT create_place_areas_mview(
'mv_place_areas_z14_20',
ARRAY['plot', 'square', 'islet']
ARRAY['plot', 'square', 'islet', 'island']
);

-- Refresh centroids views
Expand Down
15 changes: 11 additions & 4 deletions images/tiler-imposm/queries/ohm_mviews/routes_01_merge_by_date.sql
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,14 @@ SELECT log_notice('STEP 3: Backfill for osm_route_multilines');
SET statement_timeout = 2400000;
UPDATE osm_route_multilines
SET start_decdate = isodatetodecimaldate(pad_date(start_date::TEXT, 'start')::TEXT, FALSE),
end_decdate = isodatetodecimaldate(pad_date(end_date::TEXT, 'end')::TEXT, FALSE)
WHERE ST_GeometryType(geometry) IN ('ST_LineString', 'ST_MultiLineString');
end_decdate = isodatetodecimaldate(pad_date(end_date::TEXT, 'end')::TEXT, FALSE);


--- osm_route_lines
SET statement_timeout = 2400000;
UPDATE osm_route_lines
SET start_decdate = isodatetodecimaldate(pad_date(start_date::TEXT, 'start')::TEXT, FALSE),
end_decdate = isodatetodecimaldate(pad_date(end_date::TEXT, 'end')::TEXT, FALSE)
WHERE ST_GeometryType(geometry) IN ('ST_LineString', 'ST_MultiLineString');
end_decdate = isodatetodecimaldate(pad_date(end_date::TEXT, 'end')::TEXT, FALSE);

-- ============================================================================
-- STEP 4: Create Materialized View for merged routes per continuous temporal range
Expand All @@ -124,6 +122,12 @@ WITH union_sources AS (
me_highway AS highway
FROM osm_route_multilines
WHERE geometry IS NOT NULL
-- Fail-safe: drop rows whose date is present but invalid (text exists but did not
-- parse to a decimal date). An absent date stays NULL and keeps its unbounded
-- meaning; an invalid date would otherwise become unbounded and render the route
-- across all time (see issues #1369 / #1362). Hide it until the data is fixed.
AND NOT (COALESCE(start_date, '') <> '' AND start_decdate IS NULL)
AND NOT (COALESCE(end_date, '') <> '' AND end_decdate IS NULL)

UNION ALL

Expand All @@ -136,6 +140,9 @@ WITH union_sources AS (
highway
FROM osm_route_lines
WHERE geometry IS NOT NULL
-- Fail-safe: drop rows whose date is present but invalid (see multi-lines branch above).
AND NOT (COALESCE(start_date, '') <> '' AND start_decdate IS NULL)
AND NOT (COALESCE(end_date, '') <> '' AND end_decdate IS NULL)
),
-- CTE to identify ways that DO have at least one date
ways_with_dates AS (
Expand Down
2 changes: 2 additions & 0 deletions images/tiler-imposm/queries/ohm_mviews/transport_lines.sql
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ BEGIN
ELSE type
END AS type,
NULLIF(tags->'construction', '') AS construction,
NULLIF(tags->'golf', '') AS golf,
class,
NULLIF(name, '') AS name,
NULLIF(tunnel, 0) AS tunnel,
Expand Down Expand Up @@ -262,6 +263,7 @@ BEGIN
ELSE type
END AS type,
NULLIF(tags->'construction', '') AS construction,
NULLIF(tags->'golf', '') AS golf,
class,
NULLIF(name, '') AS name,
NULLIF(tunnel, 0) AS tunnel,
Expand Down
8 changes: 4 additions & 4 deletions images/tiler-imposm/queries/ohm_mviews/water.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
-- Delete existing views, in cascade
DROP MATERIALIZED VIEW IF EXISTS mv_water_areas_z16_20 CASCADE;

SELECT create_areas_mview('osm_water_areas', 'mv_water_areas_z16_20', 0, 0, 'id, osm_id, type', NULL, NULL, NULL);
SELECT create_areas_mview('osm_water_areas', 'mv_water_areas_z16_20', 0, 0, 'id, osm_id, type', NULL, 'NULLIF(tags->''golf'', '''') AS golf', NULL);
SELECT create_area_mview_from_mview('mv_water_areas_z16_20','mv_water_areas_z13_15',5,0.0,NULL);
SELECT create_area_mview_from_mview('mv_water_areas_z13_15','mv_water_areas_z10_12',20,100, 'type IN (''water'',''pond'',''basin'',''canal'',''mill_pond'',''riverbank'')');
SELECT create_area_mview_from_mview('mv_water_areas_z10_12','mv_water_areas_z8_9',100,10000, NULL);
Expand All @@ -27,9 +27,9 @@ select create_mview_centroid_from_mview('mv_water_areas_z8_9','mv_water_areas_ce
-- Water lines Materialized Views for Multiple Zoom Levels
-- ============================================================================

SELECT create_lines_mview('osm_water_lines', 'mv_water_lines_z16_20', 0, 0, 'id, osm_id, type', 'type IN (''river'', ''canal'', ''cliff'', ''dam'', ''stream'', ''ditch'', ''drain'')');
SELECT create_mview_line_from_mview('mv_water_lines_z16_20', 'mv_water_lines_z13_15', 5, 'type IN (''river'', ''canal'', ''cliff'', ''dam'', ''stream'')');
SELECT create_mview_line_from_mview('mv_water_lines_z13_15', 'mv_water_lines_z10_12', 20, 'type IN (''river'', ''canal'', ''cliff'', ''dam'')');
SELECT create_lines_mview('osm_water_lines', 'mv_water_lines_z16_20', 0, 0, 'id, osm_id, type', 'type IN (''river'', ''canal'', ''dam'', ''stream'', ''ditch'', ''drain'')');
SELECT create_mview_line_from_mview('mv_water_lines_z16_20', 'mv_water_lines_z13_15', 5, 'type IN (''river'', ''canal'', ''dam'', ''stream'')');
SELECT create_mview_line_from_mview('mv_water_lines_z13_15', 'mv_water_lines_z10_12', 20, 'type IN (''river'', ''canal'', ''dam'')');
SELECT create_mview_line_from_mview('mv_water_lines_z10_12', 'mv_water_lines_z8_9', 100, 'type IN (''river'', ''canal'')');

-- Refresh areas views
Expand Down
3 changes: 3 additions & 0 deletions images/tiler-imposm/scripts/create_mviews.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ execute_sql_file queries/ohm_mviews/transport_lines.sql

execute_sql_file queries/ohm_mviews/water.sql

## natural lines (cliff, ...) — split out of water_lines (#1345)
execute_sql_file queries/ohm_mviews/natural_lines.sql

## routes
execute_sql_file queries/ohm_mviews/routes_01_merge_by_date.sql
execute_sql_file queries/ohm_mviews/routes_02_indexed.sql
Expand Down
8 changes: 8 additions & 0 deletions images/tiler-imposm/scripts/refresh_mviews.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ water_views=(
mv_water_lines_z8_9
)

# natural lines (cliff, ...) — split out of water_lines (#1345)
natural_views=(
mv_natural_lines_z16_20
mv_natural_lines_z13_15
mv_natural_lines_z10_12
)

buildings_views=(
# areas
mv_buildings_areas_z14_15
Expand Down Expand Up @@ -293,6 +300,7 @@ refresh_mviews_group "OTHERS" 180 light "${others_views[@]}" &
refresh_mviews_group "COMMUNICATION" 180 light "${communication_views[@]}" &
refresh_mviews_group "PLACES" 180 light "${places_views[@]}" &
refresh_mviews_group "WATER" 180 light "${water_views[@]}" &
refresh_mviews_group "NATURAL" 180 light "${natural_views[@]}" &
refresh_mviews_group "BUILDINGS" 180 light "${buildings_views[@]}" &
refresh_mviews_group "ROUTES" 180 light "${routes_views[@]}" &
refresh_mviews_group "NO_ADMIN_BOUNDARIES" 180 light "${no_admin_boundaries_views[@]}" &
Expand Down
6 changes: 6 additions & 0 deletions images/tiler-imposm/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ function uploadExpiredFiles() {

# Function to upload last state file
function uploadLastState() {
# Skip when no bucket is configured (e.g. preview builds with empty
# AWS_S3_BUCKET). Without this, `aws s3 cp` runs with an empty target and
# fails every loop with "Invalid argument type".
if [ -z "$AWS_S3_BUCKET" ]; then
return
fi
# Path to the last.state.txt file
local state_file="$DIFF_DIR/last.state.txt"
local s3_path="${AWS_S3_BUCKET}/${BUCKET_IMPOSM_FOLDER}/last.state.txt"
Expand Down
1 change: 1 addition & 0 deletions images/tiler-monitor-pipeline/imposm_config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"osm_landuse_points": ["mv_landuse_points", "mv_landuse_points_centroids_z6_7", "mv_landuse_points_centroids_z16_20"],
"osm_water_areas": ["mv_water_areas_z0_2", "mv_water_areas_z16_20", "mv_water_areas_centroids_z8_9", "mv_water_areas_centroids_z16_20"],
"osm_water_lines": ["mv_water_lines_z8_9", "mv_water_lines_z16_20"],
"osm_natural_lines": ["mv_natural_lines_z10_12", "mv_natural_lines_z16_20"],
"osm_other_areas": ["mv_other_areas_z8_9", "mv_other_areas_z16_20"],
"osm_other_lines": ["mv_other_lines_z14_15", "mv_other_lines_z16_20"],
"osm_other_points": ["mv_other_points", "mv_other_points_centroids_z8_9", "mv_other_points_centroids_z16_20"],
Expand Down
4 changes: 2 additions & 2 deletions images/tiler-monitor-pipeline/tables_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"views": ["mv_other_areas_z8_9", "mv_other_areas_z16_20", "mv_other_lines_z14_15", "mv_other_lines_z16_20", "mv_other_points", "mv_other_points_centroids_z8_9", "mv_other_points_centroids_z16_20"]
},
"natural": {
"tables": ["osm_landuse_areas", "osm_landuse_lines", "osm_landuse_points", "osm_water_areas", "osm_water_lines"],
"views": ["mv_landuse_areas_z6_7", "mv_landuse_areas_z16_20", "mv_landuse_lines_z14_15", "mv_landuse_lines_z16_20", "mv_landuse_points", "mv_landuse_points_centroids_z6_7", "mv_landuse_points_centroids_z16_20", "mv_water_areas_z0_2", "mv_water_areas_z16_20", "mv_water_areas_centroids_z8_9", "mv_water_areas_centroids_z16_20", "mv_water_lines_z8_9", "mv_water_lines_z16_20"]
"tables": ["osm_landuse_areas", "osm_landuse_lines", "osm_landuse_points", "osm_water_areas", "osm_water_lines", "osm_natural_lines"],
"views": ["mv_landuse_areas_z6_7", "mv_landuse_areas_z16_20", "mv_landuse_lines_z14_15", "mv_landuse_lines_z16_20", "mv_landuse_points", "mv_landuse_points_centroids_z6_7", "mv_landuse_points_centroids_z16_20", "mv_water_areas_z0_2", "mv_water_areas_z16_20", "mv_water_areas_centroids_z8_9", "mv_water_areas_centroids_z16_20", "mv_water_lines_z8_9", "mv_water_lines_z16_20", "mv_natural_lines_z10_12", "mv_natural_lines_z16_20"]
},
"place": {
"tables": ["osm_place_areas", "osm_place_points"],
Expand Down
11 changes: 11 additions & 0 deletions images/tiler-server-martin/config/functions.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@
[null, "mv_water_lines_z16_20"]
]
},
{
"function_name": "natural_lines",
"source_layer": "natural_lines",
"exclude_columns": ["geometry", "tags"],
"min_zoom": 10,
"zoom_mapping": [
[12, "mv_natural_lines_z10_12"],
[15, "mv_natural_lines_z13_15"],
[null, "mv_natural_lines_z16_20"]
]
},
{
"function_name": "transport_areas",
"source_layer": "transport_areas",
Expand Down
2 changes: 1 addition & 1 deletion ohm/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dependencies:
- name: osm-seed
version: '0.1.0-0.dev.git.1006.h3d2d82a'
version: '0.1.0-0.dev.git.998.h0ce62c6'
repository: https://osm-seed.github.io/osm-seed-chart/
Loading
Loading