Skip to content

Remove unused landuse kinds #497

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

Closed
wants to merge 4 commits into from
Closed
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
32 changes: 3 additions & 29 deletions tiles/src/main/java/com/protomaps/basemap/layers/Landuse.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,10 @@ public class Landuse implements ForwardingProfile.LayerPostProcessor {
cemetery
commercial
grass
farmland
residential
military
village_green
allotments
forest
meadow
grass
"""),
use("kind", fromTag("landuse"))
Expand Down Expand Up @@ -132,8 +129,6 @@ public class Landuse implements ForwardingProfile.LayerPostProcessor {
grassland
scrub
sand
wetland
bare_rock
"""),
use("kind", fromTag("natural"))
),
Expand Down Expand Up @@ -167,17 +162,13 @@ public class Landuse implements ForwardingProfile.LayerPostProcessor {
with("landuse", "brownfield"),
use("kind", "industrial")
),
rule(
with("landuse", "farmyard", "orchard"),
use("kind", "farmland")
),
rule(
with("man_made", "bridge"),
use("kind", "pedestrian")
),
rule(
with("area:aeroway", "taxiway", "runway"),
use("kind", "other")
use("kind", fromTag("area:aeroway"))
),
rule(
with("place", "neighbourhood"),
Expand Down Expand Up @@ -248,12 +239,9 @@ public void processOsm(SourceFeature sf, FeatureCollector features) {
String kind = getString(sf, matches, "kind", "other");

features.polygon(this.name())
.setId(FeatureId.create(sf))
.setId(1)
// Core Tilezen schema properties
.setAttr("kind", kind)
.setAttr("sort_rank", 189)
// NOTE: (nvkelso 20230622) Consider zoom 5 instead...
// But to match Protomaps v2 we do earlier
.setZoomRange(2, 15)
.setMinPixelSize(2.0);

Expand All @@ -269,20 +257,6 @@ public String name() {

@Override
public List<VectorTile.Feature> postProcess(int zoom, List<VectorTile.Feature> items) throws GeometryException {
if (zoom == 15)
return items;
int minArea = 400 / (4096 * 4096) * (256 * 256);
if (zoom == 6)
minArea = 600 / (4096 * 4096) * (256 * 256);
else if (zoom <= 5)
minArea = 800 / (4096 * 4096) * (256 * 256);
items = Area.filterArea(items, minArea);

// We only care about park boundaries inside groups of adjacent parks at higher zooms when they are labeled
// so at lower zooms we merge them to reduce file size
if (zoom <= 6) {
return FeatureMerge.mergeNearbyPolygons(items, 3.125, 3.125, 0.5, 0.5);
}
return items;
return FeatureMerge.mergeNearbyPolygons(items, 3.125, 3.125, 0.5, 0.5);
}
}
10 changes: 10 additions & 0 deletions tiles/src/test/java/com/protomaps/basemap/layers/LanduseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ void testFromTagAeroway() {
List.of(Map.of("kind", "runway")),
processWith("aeroway", "runway")
);

assertFeatures(15,
List.of(Map.of("kind", "runway")),
processWith("area:aeroway", "runway")
);

assertFeatures(15,
List.of(Map.of("kind", "taxiway")),
processWith("area:aeroway", "taxiway")
);
}

@Test
Expand Down
Loading