Skip to content

Commit

Permalink
M6 base improvements (#202)
Browse files Browse the repository at this point in the history
* Adding airport gates to infrastructure

* refactor surface to defs and add to land and infrastructure officially.

* Adds point and linestring beach features into `land` type

* fix missing level values in union

* Adding reefs for all land types

* Prioritize national park boundaries

* Update water.sql

* Adding polygonal footways to infrastructure as pedestrian

* add more bridge-related features

* cast level as int

* Adds pedestrian_crossing

* Update land.sql

* replace colon with underscore
  • Loading branch information
jenningsanderson authored and vcschapp committed Jun 12, 2024
1 parent d13a688 commit 581aefa
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 15 deletions.
28 changes: 28 additions & 0 deletions schema/base/defs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions schema/base/infrastructure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ properties:
- observation
- parking
- parking_space
- pedestrian_crossing
- picnic_table
- pier
- pipeline
Expand Down Expand Up @@ -166,3 +167,4 @@ properties:
- watchtower
- water_tower
- weir
surface: { "$ref": ./defs.yaml#/$defs/propertyDefinitions/surface }
1 change: 1 addition & 0 deletions schema/base/land.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ properties:
- wetland
- wood
elevation: { "$ref": ./defs.yaml#/$defs/propertyDefinitions/elevation }
surface: { "$ref": ./defs.yaml#/$defs/propertyDefinitions/surface }
4 changes: 1 addition & 3 deletions schema/base/land_use.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
60 changes: 52 additions & 8 deletions task-force-docs/base/infrastructure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ SELECT
-- Airports
WHEN class IN (
'airport',
'airport_gate',
'airstrip',
'helipad',
'heliport',
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -151,6 +153,7 @@ SELECT
'atm',
'bench',
'information',
'pedestrian_crossing',
'picnic_table',
'post_box',
'toilets',
Expand Down Expand Up @@ -195,6 +198,8 @@ SELECT
'access',
'aerodrome:type',
'aerodrome',
'bridge:support',
'bridge:structure',
'amenity',
'barrier',
'icao',
Expand Down Expand Up @@ -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,
Expand All @@ -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'
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -426,6 +467,8 @@ FROM (
ARRAY[
'barrier',
'bridge',
'bridge:support',
'bridge:structure',
'communication:mobile_phone',
'communication',
'man_made',
Expand All @@ -439,6 +482,7 @@ FROM (
'aerialway',
'aeroway',
'amenity',
'footway',
'highway',
'icao',
'public_transport',
Expand Down
42 changes: 40 additions & 2 deletions task-force-docs/base/land.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -247,28 +280,32 @@ WHERE
OR (
wkt_geometry LIKE '%POINT%'
AND class IN (
'beach',
'cave_entrance',
'cliff',
'hill',
'mountain_range',
'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'
)
Expand Down Expand Up @@ -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}'
Expand Down
3 changes: 3 additions & 0 deletions task-force-docs/base/land_use.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions task-force-docs/base/water.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 581aefa

Please sign in to comment.