From dc04ff20c40b868d24a91d58773a6241a9d7ee43 Mon Sep 17 00:00:00 2001 From: Matt Amos Date: Fri, 11 Jan 2019 17:24:48 +0000 Subject: [PATCH 1/3] Add wetland POIs with kind_detail. --- docs/layers.md | 4 + integration-test/1253-wetland-kind-detail.py | 121 +++++++++++++++++++ yaml/landuse.yaml | 18 +-- yaml/pois.yaml | 9 ++ 4 files changed, 143 insertions(+), 9 deletions(-) create mode 100644 integration-test/1253-wetland-kind-detail.py diff --git a/docs/layers.md b/docs/layers.md index 68ad37584..5c6442220 100644 --- a/docs/layers.md +++ b/docs/layers.md @@ -1191,6 +1191,7 @@ To resolve inconsistency in data tagging in OpenStreetMap we normalize several o * `watermill` - A structure for using water power to do work. Note that this is different from a modern structure to generate electric power from water, which would be a `generator`. Abandoned or disused features are not shown unless they are attractions, landmarks or other kinds. * `waterway_fuel` * `wayside_cross` +* `wetland` with `kind_detail` property. * `wharf` with mooring property. * `wilderness_hut` * `wildlife_park` @@ -1251,6 +1252,9 @@ Common values include `pit_latrine`, ` flush`, ` chemical`, ` pour_flush`, ` buc Common values include: `drinkable_powered`, `drinkable_manual`, `drinkable_no_pump`, `drinkable`, `not_drinkable_powered`, `not_drinkable_manual`, `not_drinkable_no_pump`, `not_drinkable`. +#### Wetland `kind_detail` values +The value of the OpenStreetMap `wetland` tag. If available, value will be one of: `bog`, `fen`, `mangrove`, `marsh`, `mud`, `reedbed`, `saltern`, `saltmarsh`, `string_bog`, `swamp`, `tidalflat`, `wet_meadow`. + ## Roads (Transportation) diff --git a/integration-test/1253-wetland-kind-detail.py b/integration-test/1253-wetland-kind-detail.py new file mode 100644 index 000000000..20023f4c2 --- /dev/null +++ b/integration-test/1253-wetland-kind-detail.py @@ -0,0 +1,121 @@ +# -*- encoding: utf-8 -*- +from . import FixtureTest + + +class WetlandTest(FixtureTest): + + def test_landuse_saltmarsh(self): + import dsl + + z, x, y = (16, 19323, 24662) + + self.generate_fixtures( + # https://www.openstreetmap.org/way/50977043 + dsl.way(50977043, dsl.box_area(z, x, y, 122442), { + 'boundary': 'national_park', + 'landuse': 'meadow', + 'natural': 'wetland', + 'place': 'island', + 'source': 'openstreetmap.org', + 'wetland': 'saltmarsh', + }), + ) + + self.assert_has_feature( + z, x, y, 'landuse', { + 'id': 50977043, + 'kind': 'wetland', + 'kind_detail': 'saltmarsh', + }) + + def test_yellow_bar_hassock(self): + import dsl + + z, x, y = (16, 19325, 24665) + + self.generate_fixtures( + # https://www.openstreetmap.org/way/50976996 + dsl.way(50976996, dsl.box_area(z, x, y, 930605), { + 'boundary': 'national_park', + 'ele': '0', + 'gnis:county_id': '047', + 'gnis:created': '01/23/1980', + 'gnis:feature_id': '971817', + 'gnis:state_id': '36', + 'name': 'Yellow Bar Hassock', + 'natural': 'wetland', + 'place': 'island', + 'source': 'openstreetmap.org', + 'wetland': 'saltmarsh', + }), + ) + + self.assert_has_feature( + z, x, y, 'pois', { + 'id': 50976996, + 'kind': 'wetland', + 'kind_detail': 'saltmarsh', + }) + + def test_ruffle_bar(self): + # sounds like candy... + import dsl + + z, x, y = (16, 19322, 24667) + + self.generate_fixtures( + # https://www.openstreetmap.org/way/110163359 + dsl.way(110163359, dsl.box_area(z, x, y, 900561), { + 'boundary': 'national_park', + 'ele': '4', + 'gnis:county_id': '047', + 'gnis:created': '01/23/1980', + 'gnis:feature_id': '963071', + 'gnis:state_id': '36', + 'name': 'Ruffle Bar', + 'natural': 'wetland', + 'place': 'island', + 'source': 'openstreetmap.org', + 'wetland': 'saltmarsh', + 'wikidata': 'Q15273739', + 'wikipedia': 'en:Ruffle Bar', + }), + ) + + self.assert_has_feature( + z, x, y, 'pois', { + 'id': 110163359, + 'kind': 'wetland', + 'kind_detail': 'saltmarsh', + }) + + def test_big_egg_marsh(self): + import dsl + + z, x, y = (16, 19327, 24668) + + self.generate_fixtures( + # https://www.openstreetmap.org/way/50977027 + dsl.way(50977027, dsl.box_area(z, x, y, 254547), { + 'addr:state': 'NY', + 'boundary': 'national_park', + 'ele': '0', + 'gnis:county_name': 'Queens', + 'gnis:created': '01/23/1980', + 'gnis:feature_id': '943878', + 'gnis:feature_type': 'Swamp', + 'name': 'Big Egg Marsh', + 'natural': 'wetland', + 'place': 'island', + 'source': 'openstreetmap.org', + 'wetland': 'saltmarsh', + 'wikidata': 'Q34642571', + }), + ) + + self.assert_has_feature( + z, x, y, 'pois', { + 'id': 50977027, + 'kind': 'wetland', + 'kind_detail': 'saltmarsh', + }) diff --git a/yaml/landuse.yaml b/yaml/landuse.yaml index 2b1d96218..955ac132f 100644 --- a/yaml/landuse.yaml +++ b/yaml/landuse.yaml @@ -240,6 +240,15 @@ filters: output: <<: *output_properties kind: fort + - filter: {natural: wetland} + min_zoom: { clamp: { max: 16, min: 9, value: { col: zoom } } } + output: + <<: *output_properties + kind: wetland + kind_detail: + case: + - when: { wetland: [bog, fen, mangrove, marsh, mud, reedbed, saltern, saltmarsh, string_bog, swamp, tidalflat, wet_meadow] } + then: {col: wetland} ############################################################ # TIER 2 OVERRIDES @@ -1073,15 +1082,6 @@ filters: output: <<: *output_properties kind: scrub - - filter: {natural: wetland} - min_zoom: { clamp: { max: 16, min: 9, value: { col: zoom } } } - output: - <<: *output_properties - kind: wetland - kind_detail: - case: - - when: { wetland: [bog, fen, mangrove, marsh, mud, reedbed, saltern, saltmarsh, string_bog, swamp, tidalflat, wet_meadow] } - then: {col: wetland} - filter: {natural: park} min_zoom: { clamp: { max: 16, min: 9, value: { col: zoom } } } output: diff --git a/yaml/pois.yaml b/yaml/pois.yaml index 4a711aee4..e18260d76 100644 --- a/yaml/pois.yaml +++ b/yaml/pois.yaml @@ -377,6 +377,15 @@ filters: output: <<: *output_properties kind: observatory + - filter: {natural: wetland} + min_zoom: { clamp: { max: 16, min: 9, value: { col: zoom } } } + output: + <<: *output_properties + kind: wetland + kind_detail: + case: + - when: { wetland: [bog, fen, mangrove, marsh, mud, reedbed, saltern, saltmarsh, string_bog, swamp, tidalflat, wet_meadow] } + then: {col: wetland} ############################################################ # TIER 2 OVERRIDES From d4e9f9baa30d7efa3b2e34ec81ccd837c25453c0 Mon Sep 17 00:00:00 2001 From: Matt Amos Date: Fri, 11 Jan 2019 17:39:53 +0000 Subject: [PATCH 2/3] Reorder under specific national parks, but above the generic tier2 national park, so that we don't mistakenly classify a national park as a wetland instead. --- yaml/landuse.yaml | 30 +++++++++++++++++++++--------- yaml/pois.yaml | 30 +++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/yaml/landuse.yaml b/yaml/landuse.yaml index 955ac132f..371ce3640 100644 --- a/yaml/landuse.yaml +++ b/yaml/landuse.yaml @@ -240,15 +240,6 @@ filters: output: <<: *output_properties kind: fort - - filter: {natural: wetland} - min_zoom: { clamp: { max: 16, min: 9, value: { col: zoom } } } - output: - <<: *output_properties - kind: wetland - kind_detail: - case: - - when: { wetland: [bog, fen, mangrove, marsh, mud, reedbed, saltern, saltmarsh, string_bog, swamp, tidalflat, wet_meadow] } - then: {col: wetland} ############################################################ # TIER 2 OVERRIDES @@ -385,6 +376,27 @@ filters: <<: *output_properties kind: national_park tier: 2 + + ############################################################ + # mid-tier 2 overrides + # + # the boundary=national_park appears to get used for a ton of + # stuff that isn't actually a national park, so we match a + # few things in advance which seem to be more specific. + ############################################################ + - filter: {natural: wetland} + min_zoom: { clamp: { max: 16, min: 9, value: { col: zoom } } } + output: + <<: *output_properties + kind: wetland + kind_detail: + case: + - when: { wetland: [bog, fen, mangrove, marsh, mud, reedbed, saltern, saltmarsh, string_bog, swamp, tidalflat, wet_meadow] } + then: {col: wetland} + + ############################################################ + # TIER 2 (continued...) + ############################################################ - filter: any: leisure: park diff --git a/yaml/pois.yaml b/yaml/pois.yaml index e18260d76..3ad2b0319 100644 --- a/yaml/pois.yaml +++ b/yaml/pois.yaml @@ -377,15 +377,6 @@ filters: output: <<: *output_properties kind: observatory - - filter: {natural: wetland} - min_zoom: { clamp: { max: 16, min: 9, value: { col: zoom } } } - output: - <<: *output_properties - kind: wetland - kind_detail: - case: - - when: { wetland: [bog, fen, mangrove, marsh, mud, reedbed, saltern, saltmarsh, string_bog, swamp, tidalflat, wet_meadow] } - then: {col: wetland} ############################################################ # TIER 2 OVERRIDES @@ -501,6 +492,27 @@ filters: <<: *output_properties kind: national_park tier: 2 + + ############################################################ + # mid-tier 2 overrides + # + # the boundary=national_park appears to get used for a ton of + # stuff that isn't actually a national park, so we match a + # few things in advance which seem to be more specific. + ############################################################ + - filter: {natural: wetland} + min_zoom: { clamp: { max: 16, min: 9, value: { col: zoom } } } + output: + <<: *output_properties + kind: wetland + kind_detail: + case: + - when: { wetland: [bog, fen, mangrove, marsh, mud, reedbed, saltern, saltmarsh, string_bog, swamp, tidalflat, wet_meadow] } + then: {col: wetland} + + ############################################################ + # TIER 2 (continued...) + ############################################################ - filter: any: leisure: park From 83eecabe8e9c12b58bc683e8e9ca75ed781bd29b Mon Sep 17 00:00:00 2001 From: "Nathaniel V. KELSO" Date: Fri, 11 Jan 2019 11:09:24 -0800 Subject: [PATCH 3/3] Markdown formatting --- docs/layers.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/layers.md b/docs/layers.md index 5c6442220..b99070ac1 100644 --- a/docs/layers.md +++ b/docs/layers.md @@ -1253,6 +1253,7 @@ Common values include `pit_latrine`, ` flush`, ` chemical`, ` pour_flush`, ` buc Common values include: `drinkable_powered`, `drinkable_manual`, `drinkable_no_pump`, `drinkable`, `not_drinkable_powered`, `not_drinkable_manual`, `not_drinkable_no_pump`, `not_drinkable`. #### Wetland `kind_detail` values + The value of the OpenStreetMap `wetland` tag. If available, value will be one of: `bog`, `fen`, `mangrove`, `marsh`, `mud`, `reedbed`, `saltern`, `saltmarsh`, `string_bog`, `swamp`, `tidalflat`, `wet_meadow`.