Skip to content

Commit

Permalink
Merge 49ede62 into 1cea73c
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeLonewolf committed Aug 26, 2021
2 parents 1cea73c + 49ede62 commit ddfa6ba
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
10 changes: 5 additions & 5 deletions layers/water/mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ tables:
- name: waterway
key: waterway
type: string
- name: water
key: water
type: string
- name: is_intermittent
key: intermittent
type: bool
Expand All @@ -95,11 +98,8 @@ tables:
- bay
- spring
waterway:
- river
- riverbank
- stream
- canal
- drain
- ditch
- dock
water:
- river
type: polygon
Binary file modified layers/water/mapping_diagram.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 10 additions & 9 deletions layers/water/water.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
CREATE OR REPLACE FUNCTION water_class(waterway text) RETURNS text AS
CREATE OR REPLACE FUNCTION water_class(waterway text, water text) RETURNS text AS
$$
SELECT CASE
WHEN waterway='riverbank' THEN 'river'
%%FIELD_MAPPING: class %%
ELSE 'river'
ELSE 'lake'
END;
$$ LANGUAGE SQL IMMUTABLE
PARALLEL SAFE;
Expand Down Expand Up @@ -314,7 +315,7 @@ FROM osm_ocean_polygon_gen_z6
UNION ALL
-- etldoc: osm_water_polygon_gen_z6 -> water_z6
SELECT geometry,
water_class(waterway) AS class,
water_class(waterway, water) AS class,
is_intermittent,
NULL::boolean AS is_bridge,
NULL::boolean AS is_tunnel
Expand All @@ -334,7 +335,7 @@ FROM osm_ocean_polygon_gen_z7
UNION ALL
-- etldoc: osm_water_polygon_gen_z7 -> water_z7
SELECT geometry,
water_class(waterway) AS class,
water_class(waterway, water) AS class,
is_intermittent,
NULL::boolean AS is_bridge,
NULL::boolean AS is_tunnel
Expand All @@ -354,7 +355,7 @@ FROM osm_ocean_polygon_gen_z8
UNION ALL
-- etldoc: osm_water_polygon_gen_z8 -> water_z8
SELECT geometry,
water_class(waterway) AS class,
water_class(waterway, water) AS class,
is_intermittent,
NULL::boolean AS is_bridge,
NULL::boolean AS is_tunnel
Expand All @@ -374,7 +375,7 @@ FROM osm_ocean_polygon_gen_z9
UNION ALL
-- etldoc: osm_water_polygon_gen_z9 -> water_z9
SELECT geometry,
water_class(waterway) AS class,
water_class(waterway, water) AS class,
is_intermittent,
NULL::boolean AS is_bridge,
NULL::boolean AS is_tunnel
Expand All @@ -394,7 +395,7 @@ FROM osm_ocean_polygon_gen_z10
UNION ALL
-- etldoc: osm_water_polygon_gen_z10 -> water_z10
SELECT geometry,
water_class(waterway) AS class,
water_class(waterway, water) AS class,
is_intermittent,
NULL::boolean AS is_bridge,
NULL::boolean AS is_tunnel
Expand All @@ -414,7 +415,7 @@ FROM osm_ocean_polygon_gen_z11
UNION ALL
-- etldoc: osm_water_polygon_gen_z11 -> water_z11
SELECT geometry,
water_class(waterway) AS class,
water_class(waterway, water) AS class,
is_intermittent,
NULL::boolean AS is_bridge,
NULL::boolean AS is_tunnel
Expand All @@ -434,7 +435,7 @@ FROM osm_ocean_polygon_union
UNION ALL
-- etldoc: osm_water_polygon -> water_z12
SELECT geometry,
water_class(waterway) AS class,
water_class(waterway, water) AS class,
is_intermittent,
is_bridge,
is_tunnel
Expand Down
10 changes: 7 additions & 3 deletions layers/water/water.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ layer:
class:
description: |
All water polygons from [OpenStreetMapData](http://osmdata.openstreetmap.de/) have the class `ocean`.
Water bodies with the [`waterway`](http://wiki.openstreetmap.org/wiki/Key:waterway) tag are classified as `lake`, `dock`, or `river`.
Water bodies with the [`waterway=riverbank`](http://wiki.openstreetmap.org/wiki/Tag:waterway=riverbank)
or [`water=river`](http://wiki.openstreetmap.org/wiki/Tag:water=river) tag are classified as river. Wet and dry docks
tagged [`waterway=dock`](http://wiki.openstreetmap.org/wiki/Tag:waterway=dock) are classified as a `dock`.
All other water bodies are classified as `lake`.
values:
lake:
waterway: ['', 'lake']
dock:
waterway: 'dock'
river:
water: 'river'
waterway: 'riverbank'
lake:
waterway: ''
ocean:
intermittent:
description: |
Expand Down
Binary file modified layers/water_name/mapping_diagram.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ddfa6ba

Please sign in to comment.