Skip to content

Commit af7c9e9

Browse files
authored
Closes #204 and adds POIs for landuse=village_green, laduse=allotments, leisure=playground (#212)
1 parent a8ee378 commit af7c9e9

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

tiles/src/main/java/com/protomaps/basemap/layers/Pois.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public void processFeature(SourceFeature sf, FeatureCollector features) {
3939
sf.hasTag("boundary", "national_park", "protected_area") ||
4040
sf.hasTag("craft") ||
4141
sf.hasTag("historic") ||
42-
sf.hasTag("landuse", "cemetery", "recreation_ground", "winter_sports", "quarry", "park", "forest", "military") ||
42+
sf.hasTag("landuse", "cemetery", "recreation_ground", "winter_sports", "quarry", "park", "forest", "military",
43+
"village_green", "allotments") ||
4344
sf.hasTag("leisure") ||
4445
sf.hasTag("natural", "beach") ||
4546
sf.hasTag("railway", "station") ||
@@ -323,7 +324,8 @@ public void processFeature(SourceFeature sf, FeatureCollector features) {
323324
} else if (kind.equals("forest") ||
324325
kind.equals("park") ||
325326
kind.equals("protected_area") ||
326-
kind.equals("nature_reserve")) {
327+
kind.equals("nature_reserve") ||
328+
kind.equals("village_green")) {
327329
if (wayArea > 10000) {
328330
minZoom = 7;
329331
} else if (wayArea > 4000) {
@@ -368,6 +370,14 @@ public void processFeature(SourceFeature sf, FeatureCollector features) {
368370
minZoom = 16;
369371
}
370372
// Typically for "building" derived label placements for shops and other businesses
373+
} else if (kind.equals("allotments")) {
374+
if (wayArea > 0.01) {
375+
minZoom = 15;
376+
} else {
377+
minZoom = 16;
378+
}
379+
} else if (kind.equals("playground")) {
380+
minZoom = 17;
371381
} else {
372382
if (wayArea > 10) {
373383
minZoom = 11;

tiles/src/test/java/com/protomaps/basemap/layers/PoisTest.java

+44
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,48 @@ void busStop() {
3434
0
3535
)));
3636
}
37+
38+
@Test
39+
void allotments() {
40+
// this test shows two list elements because we're running against the whole profile, which means we're getting
41+
// results form multiple layer classes. This may mean the test breaks when other layer classes are changed.
42+
assertFeatures(15,
43+
List.of(Map.of("pmap:kind", "allotments"),
44+
Map.of("pmap:kind", "allotments", "pmap:min_zoom", 16, "name", "Kleingartenverein Kartoffel")),
45+
process(SimpleFeature.create(
46+
newPolygon(0, 0, 0, 1, 1, 1, 1, 0, 0, 0),
47+
new HashMap<>(Map.of("landuse", "allotments", "name", "Kleingartenverein Kartoffel")),
48+
"osm",
49+
null,
50+
0
51+
)));
52+
}
53+
54+
@Test
55+
void villageGreen() {
56+
assertFeatures(15,
57+
List.of(Map.of("pmap:kind", "village_green"),
58+
Map.of("pmap:kind", "village_green", "pmap:min_zoom", 8, "name", "Stadtpark Eiche")),
59+
process(SimpleFeature.create(
60+
newPolygon(0, 0, 0, 1, 1, 1, 1, 0, 0, 0),
61+
new HashMap<>(Map.of("landuse", "village_green", "name", "Stadtpark Eiche")),
62+
"osm",
63+
null,
64+
0
65+
)));
66+
}
67+
68+
@Test
69+
void playground() {
70+
assertFeatures(15,
71+
List.of(Map.of("pmap:kind", "playground"),
72+
Map.of("pmap:kind", "playground", "pmap:min_zoom", 18, "name", "Spielwiese")),
73+
process(SimpleFeature.create(
74+
newPolygon(0, 0, 0, 1, 1, 1, 1, 0, 0, 0),
75+
new HashMap<>(Map.of("leisure", "playground", "name", "Spielwiese")),
76+
"osm",
77+
null,
78+
0
79+
)));
80+
}
3781
}

0 commit comments

Comments
 (0)