Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #204 and adds POIs for landuse=village_green, laduse=allotment… #212

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions tiles/src/main/java/com/protomaps/basemap/layers/Pois.java
Original file line number Diff line number Diff line change
Expand Up @@ -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") ||
Expand Down Expand Up @@ -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")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could work out... but might need some adjustments. Generally village greens are pretty small, and the other features in this grouping can get much larger.

Most similar Tilezen section is here https://github.com/tilezen/vector-datasource/blob/master/yaml/pois.yaml#L143-L152, but there's some related clamping for commons.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What adjustments are you thinking about?

if (wayArea > 10000) {
minZoom = 7;
} else if (wayArea > 4000) {
Expand Down Expand Up @@ -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;
Expand Down
44 changes: 44 additions & 0 deletions tiles/src/test/java/com/protomaps/basemap/layers/PoisTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
)));
}
}
Loading