diff --git a/schema/base/defs.yaml b/schema/base/defs.yaml index ade66f07..32d70a4e 100644 --- a/schema/base/defs.yaml +++ b/schema/base/defs.yaml @@ -11,6 +11,34 @@ description: Common schema definitions the base theme (primarily from OSM) description: Elevation above sea level (in meters) of the feature. type: integer maximum: 9000 + surface: + description: Surface material, mostly from the OSM tag, with some normalization. + type: string + enum: + - asphalt + - cobblestone + - compacted + - concrete + - concrete_plates + - dirt + - earth + - fine_gravel + - grass + - gravel + - ground + - paved + - paving_stones + - pebblestone + - recreation_grass + - recreation_paved + - recreation_sand + - rubber + - sand + - sett + - tartan + - unpaved + - wood + - woodchips propertyContainers: osmPropertiesContainer: title: "OSM Properties" diff --git a/schema/base/infrastructure.yaml b/schema/base/infrastructure.yaml index 18e06258..8c5a456a 100644 --- a/schema/base/infrastructure.yaml +++ b/schema/base/infrastructure.yaml @@ -119,6 +119,7 @@ properties: - observation - parking - parking_space + - pedestrian_crossing - picnic_table - pier - pipeline @@ -166,3 +167,4 @@ properties: - watchtower - water_tower - weir + surface: { "$ref": ./defs.yaml#/$defs/propertyDefinitions/surface } diff --git a/schema/base/land.yaml b/schema/base/land.yaml index 699af37b..ece376c8 100644 --- a/schema/base/land.yaml +++ b/schema/base/land.yaml @@ -86,3 +86,4 @@ properties: - wetland - wood elevation: { "$ref": ./defs.yaml#/$defs/propertyDefinitions/elevation } + surface: { "$ref": ./defs.yaml#/$defs/propertyDefinitions/surface } diff --git a/schema/base/land_use.yaml b/schema/base/land_use.yaml index 3af079a4..4db53a0c 100644 --- a/schema/base/land_use.yaml +++ b/schema/base/land_use.yaml @@ -161,6 +161,4 @@ properties: - works - zoo elevation: { "$ref": ./defs.yaml#/$defs/propertyDefinitions/elevation } - surface: - description: Surface material, mostly form the OSM tag, with some normalization. - type: string + surface: { "$ref": ./defs.yaml#/$defs/propertyDefinitions/surface } diff --git a/task-force-docs/base/infrastructure.sql b/task-force-docs/base/infrastructure.sql index 29a3e034..ebd3109c 100644 --- a/task-force-docs/base/infrastructure.sql +++ b/task-force-docs/base/infrastructure.sql @@ -47,6 +47,7 @@ SELECT -- Airports WHEN class IN ( 'airport', + 'airport_gate', 'airstrip', 'helipad', 'heliport', @@ -88,14 +89,15 @@ SELECT -- Bridges WHEN class IN ( - 'bridge', - 'viaduct', - 'boardwalk', 'aqueduct', - 'movable', - 'covered', + 'boardwalk', + 'bridge_support', + 'bridge', 'cantilever', - 'trestle' + 'covered', + 'movable', + 'trestle', + 'viaduct' ) THEN 'bridge' -- Communication @@ -151,6 +153,7 @@ SELECT 'atm', 'bench', 'information', + 'pedestrian_crossing', 'picnic_table', 'post_box', 'toilets', @@ -195,6 +198,8 @@ SELECT 'access', 'aerodrome:type', 'aerodrome', + 'bridge:support', + 'bridge:structure', 'amenity', 'barrier', 'icao', @@ -227,8 +232,37 @@ SELECT confidence double ) ) ] AS sources, - - tags['surface'] AS surface, + CASE + WHEN tags['surface'] IN ( + 'asphalt', + 'cobblestone', + 'compacted', + 'concrete', + 'concrete:plates', + 'dirt', + 'earth', + 'fine_gravel', + 'grass', + 'gravel', + 'ground', + 'paved', + 'paving_stones', + 'pebblestone', + 'recreation_grass', + 'recreation_paved', + 'recreation_sand', + 'rubber', + 'sand', + 'sett', + 'tartan', + 'unpaved', + 'wood', + 'woodchips' + ) THEN tags['surface'] + WHEN tags['surface'] = 'concrete:plates' + THEN 'concrete_plates' + ELSE NULL + END AS surface, -- Overture's concept of `layer` is called level TRY_CAST(tags['layer'] AS int) AS level, @@ -246,7 +280,12 @@ FROM ( -- Air WHEN tags['aeroway'] IN ('runway', 'taxiway', 'airstrip', 'helipad') THEN tags['aeroway'] + -- Pedestrian + WHEN tags['highway'] IS NULL AND tags['footway'] IN ('crossing') AND (wkt LIKE 'MULTIPOLYGON%' OR wkt LIKE 'POLYGON%') THEN 'pedestrian_crossing' + -- Specific airport classing + WHEN tags['aeroway'] = 'gate' THEN 'airport_gate' + WHEN tags['aeroway'] = 'aerodrome' THEN CASE WHEN tags['aerodrome:type'] = 'military' OR tags['landuse'] = 'military' OR tags['military'] IN ( 'airfield' @@ -390,6 +429,8 @@ FROM ( -- TODO: bridges, dams? WHEN tags['bridge'] = 'yes' THEN 'bridge' + WHEN tags['bridge:support'] IS NOT NULL THEN + 'bridge_support' WHEN tags['bridge'] IN ( 'aqueduct', 'boardwalk', @@ -426,6 +467,8 @@ FROM ( ARRAY[ 'barrier', 'bridge', + 'bridge:support', + 'bridge:structure', 'communication:mobile_phone', 'communication', 'man_made', @@ -439,6 +482,7 @@ FROM ( 'aerialway', 'aeroway', 'amenity', + 'footway', 'highway', 'icao', 'public_transport', diff --git a/task-force-docs/base/land.sql b/task-force-docs/base/land.sql index 02ec255f..f7ebd12c 100644 --- a/task-force-docs/base/land.sql +++ b/task-force-docs/base/land.sql @@ -138,6 +138,39 @@ SELECT -- Elevation as integer (meters above sea level) TRY_CAST(tags['ele'] AS integer) AS elevation, + -- Surface + CASE + WHEN tags['surface'] IN ( + 'asphalt', + 'cobblestone', + 'compacted', + 'concrete', + 'concrete:plates', + 'dirt', + 'earth', + 'fine_gravel', + 'grass', + 'gravel', + 'ground', + 'paved', + 'paving_stones', + 'pebblestone', + 'recreation_grass', + 'recreation_paved', + 'recreation_sand', + 'rubber', + 'sand', + 'sett', + 'tartan', + 'unpaved', + 'wood', + 'woodchips' + ) THEN tags['surface'] + WHEN tags['surface'] = 'concrete:plates' + THEN 'concrete_plates' + ELSE NULL + END AS surface, + wkt_geometry FROM ( @@ -247,6 +280,7 @@ WHERE OR ( wkt_geometry LIKE '%POINT%' AND class IN ( + 'beach', 'cave_entrance', 'cliff', 'hill', @@ -254,21 +288,24 @@ WHERE 'peak', 'peninsula', 'plateau', + 'reef', 'saddle', 'shrub', + 'stone', 'tree', 'valley', - 'volcano', - 'stone' + 'volcano' ) ) -- Valid LineStrings OR ( wkt_geometry LIKE '%LINESTRING%' AND class IN ( + 'beach', 'cliff', 'mountain_range', 'tree_row', + 'reef', 'ridge', 'valley' ) @@ -310,6 +347,7 @@ SELECT NULL AS wikidata, NULL AS level, NULL AS elevation, + NULL AS surface, wkt AS wkt_geometry FROM {daylight_earth_table} WHERE release = '{daylight_version}' diff --git a/task-force-docs/base/land_use.sql b/task-force-docs/base/land_use.sql index 70972fee..f9aab631 100644 --- a/task-force-docs/base/land_use.sql +++ b/task-force-docs/base/land_use.sql @@ -319,6 +319,9 @@ FROM ( 'theme_park' ) THEN tags['tourism'] + -- Give National Parks top priority since it might have other tags. + WHEN tags['boundary'] = 'national_park' THEN 'national_park' + -- Aboriginal Lands & Reservations WHEN tags['boundary'] IN ('aboriginal_lands') OR ( tags['boundary'] = 'protected_area' AND tags['protect_class'] = '24' diff --git a/task-force-docs/base/water.sql b/task-force-docs/base/water.sql index 77a7821d..29c64dfa 100644 --- a/task-force-docs/base/water.sql +++ b/task-force-docs/base/water.sql @@ -85,7 +85,7 @@ SELECT tags['wikidata'] as wikidata, -- Overture's concept of `layer` is called level - TRY_CAST(tags['layer'] AS int) AS level, + TRY_CAST(tags['layer'] AS integer) AS level, -- Elevation is common on some ponds / lakes. TRY_CAST(tags['ele'] AS integer) AS elevation, @@ -324,7 +324,7 @@ SELECT ) ] as sources, -- Wikidata is a top-level property in the OSM Container NULL as wikidata, - 0 as level, -- it's the ocean, does it go lower? + 0 AS level, -- Other type=water top-level attributes 0 AS elevation, TRUE AS is_salt,