From ca2de427e124a4b7580bc53d12923c155ce7d7bc Mon Sep 17 00:00:00 2001 From: Lena Brueder Date: Wed, 24 Jan 2024 16:54:43 +0100 Subject: [PATCH] Closes #204 and adds POIs for landuse=village_green, laduse=allotments, leisure=playground --- .../com/protomaps/basemap/layers/Pois.java | 14 +++++- .../protomaps/basemap/layers/PoisTest.java | 44 +++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/tiles/src/main/java/com/protomaps/basemap/layers/Pois.java b/tiles/src/main/java/com/protomaps/basemap/layers/Pois.java index 53a9fbdd..6698ac3c 100644 --- a/tiles/src/main/java/com/protomaps/basemap/layers/Pois.java +++ b/tiles/src/main/java/com/protomaps/basemap/layers/Pois.java @@ -39,7 +39,8 @@ public void processFeature(SourceFeature sf, FeatureCollector features) { sf.hasTag("boundary", "national_park", "protected_area") || sf.hasTag("craft") || sf.hasTag("historic") || - sf.hasTag("landuse", "cemetery", "recreation_ground", "winter_sports", "quarry", "park", "forest", "military") || + sf.hasTag("landuse", "cemetery", "recreation_ground", "winter_sports", "quarry", "park", "forest", "military", + "village_green", "allotments") || sf.hasTag("leisure") || sf.hasTag("natural", "beach") || sf.hasTag("railway", "station") || @@ -323,7 +324,8 @@ public void processFeature(SourceFeature sf, FeatureCollector features) { } else if (kind.equals("forest") || kind.equals("park") || kind.equals("protected_area") || - kind.equals("nature_reserve")) { + kind.equals("nature_reserve") || + kind.equals("village_green")) { if (wayArea > 10000) { minZoom = 7; } else if (wayArea > 4000) { @@ -368,6 +370,14 @@ public void processFeature(SourceFeature sf, FeatureCollector features) { minZoom = 16; } // Typically for "building" derived label placements for shops and other businesses + } else if (kind.equals("allotments")) { + if (wayArea > 0.01) { + minZoom = 15; + } else { + minZoom = 16; + } + } else if (kind.equals("playground")) { + minZoom = 17; } else { if (wayArea > 10) { minZoom = 11; diff --git a/tiles/src/test/java/com/protomaps/basemap/layers/PoisTest.java b/tiles/src/test/java/com/protomaps/basemap/layers/PoisTest.java index 82f3e484..e326f1e4 100644 --- a/tiles/src/test/java/com/protomaps/basemap/layers/PoisTest.java +++ b/tiles/src/test/java/com/protomaps/basemap/layers/PoisTest.java @@ -34,4 +34,48 @@ void busStop() { 0 ))); } + + @Test + void allotments() { + // this test shows two list elements because we're running against the whole profile, which means we're getting + // results form multiple layer classes. This may mean the test breaks when other layer classes are changed. + assertFeatures(15, + List.of(Map.of("pmap:kind", "allotments"), + Map.of("pmap:kind", "allotments", "pmap:min_zoom", 16, "name", "Kleingartenverein Kartoffel")), + process(SimpleFeature.create( + newPolygon(0, 0, 0, 1, 1, 1, 1, 0, 0, 0), + new HashMap<>(Map.of("landuse", "allotments", "name", "Kleingartenverein Kartoffel")), + "osm", + null, + 0 + ))); + } + + @Test + void villageGreen() { + assertFeatures(15, + List.of(Map.of("pmap:kind", "village_green"), + Map.of("pmap:kind", "village_green", "pmap:min_zoom", 8, "name", "Stadtpark Eiche")), + process(SimpleFeature.create( + newPolygon(0, 0, 0, 1, 1, 1, 1, 0, 0, 0), + new HashMap<>(Map.of("landuse", "village_green", "name", "Stadtpark Eiche")), + "osm", + null, + 0 + ))); + } + + @Test + void playground() { + assertFeatures(15, + List.of(Map.of("pmap:kind", "playground"), + Map.of("pmap:kind", "playground", "pmap:min_zoom", 18, "name", "Spielwiese")), + process(SimpleFeature.create( + newPolygon(0, 0, 0, 1, 1, 1, 1, 0, 0, 0), + new HashMap<>(Map.of("leisure", "playground", "name", "Spielwiese")), + "osm", + null, + 0 + ))); + } }