diff --git a/app/src/examples.json b/app/src/examples.json index 1a272736..ea20b5d8 100644 --- a/app/src/examples.json +++ b/app/src/examples.json @@ -55,6 +55,34 @@ "center": [-122.2713, 37.8043], "zoom": 11 }, + { + "name": "oakland-hills-z14", + "description": "Area around Oakland hills", + "tags": ["oakland", "oakland-hills"], + "center": [-122.2119, 37.9001], + "zoom": 14 + }, + { + "name": "oakland-hills-z13", + "description": "Area around Oakland hills", + "tags": ["oakland", "oakland-hills"], + "center": [-122.2119, 37.9001], + "zoom": 13 + }, + { + "name": "oakland-hills-z12", + "description": "Area around Oakland hills", + "tags": ["oakland", "oakland-hills"], + "center": [-122.2119, 37.9001], + "zoom": 12 + }, + { + "name": "oakland-hills-z11", + "description": "Area around Oakland hills", + "tags": ["oakland", "oakland-hills"], + "center": [-122.2119, 37.9001], + "zoom": 11 + }, { "name": "oakland-airport-z15", "description": "Area around Oakland Airport terminals", diff --git a/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java b/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java index 5a077b81..60c48ae9 100644 --- a/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java +++ b/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java @@ -78,8 +78,9 @@ public void processOsm(SourceFeature sf, FeatureCollector features) { public void processOverture(SourceFeature sf, FeatureCollector features) { String type = sf.getString("type"); - // Filter by type field - Overture base theme land - if (!"land".equals(type)) { + // Filter by type field - Overture base theme land, subtype land only + // Other subtypes (forest, grass, shrub, wetland, rock, sand, ice) go to Landuse + if (!"land".equals(type) || !"land".equals(sf.getString("subtype"))) { return; } diff --git a/tiles/src/main/java/com/protomaps/basemap/layers/Landuse.java b/tiles/src/main/java/com/protomaps/basemap/layers/Landuse.java index 211a7a7e..b67389ff 100644 --- a/tiles/src/main/java/com/protomaps/basemap/layers/Landuse.java +++ b/tiles/src/main/java/com/protomaps/basemap/layers/Landuse.java @@ -262,6 +262,28 @@ public void processOverture(SourceFeature sf, FeatureCollector features) { return; } + if ("land".equals(sf.getString("type"))) { + String landClass = sf.getString("class"); + String kind = switch (landClass) { + case "wood", "forest" -> "wood"; + case "grassland", "grass", "meadow", "fell" -> "grassland"; + case "scrub", "heath", "shrub", "shrubbery" -> "scrub"; + case "wetland" -> "wetland"; + case "bare_rock", "scree", "stone", "rock", "shingle" -> "bare_rock"; + case "beach" -> "beach"; + case "sand" -> "sand"; + default -> null; + }; + if (kind != null && sf.canBePolygon()) { + features.polygon(LAYER_NAME) + .setAttr("kind", kind) + .setAttr("sort_rank", 189) + .setZoomRange(7, 15) + .setMinPixelSize(2.0); + } + return; + } + if (/* !"land_cover".equals(sf.getString("type")) && */ !"land_use".equals(sf.getString("type"))) { return; } diff --git a/tiles/src/test/java/com/protomaps/basemap/layers/LanduseTest.java b/tiles/src/test/java/com/protomaps/basemap/layers/LanduseTest.java index 6d112fac..83e9a5ad 100644 --- a/tiles/src/test/java/com/protomaps/basemap/layers/LanduseTest.java +++ b/tiles/src/test/java/com/protomaps/basemap/layers/LanduseTest.java @@ -255,6 +255,69 @@ void testFromTagNatural() { ); } + @Test + void testOvertureLand() { + // forest subtype, wood class → wood kind + // d3377708-0909-3bad-93a0-bccf36a3da6b + assertFeatures(15, + List.of(Map.of("kind", "wood")), + process(SimpleFeature.create( + newPolygon(0, 0, 0, 1, 1, 1, 0, 0), + new HashMap<>(Map.of("id", "d3377708-0909-3bad-93a0-bccf36a3da6b", + "theme", "base", "type", "land", "subtype", "forest", "class", "wood")), + "pm:overture", null, 0))); + + // grass subtype, grassland class → grassland kind + // 553b0479-ef8d-3e61-8160-193422ebc844 + assertFeatures(15, + List.of(Map.of("kind", "grassland")), + process(SimpleFeature.create( + newPolygon(0, 0, 0, 1, 1, 1, 0, 0), + new HashMap<>(Map.of("id", "553b0479-ef8d-3e61-8160-193422ebc844", + "theme", "base", "type", "land", "subtype", "grass", "class", "grassland")), + "pm:overture", null, 0))); + + // shrub subtype, scrub class → scrub kind + // f7254ef8-2649-31e4-9906-1a775dbde15b + assertFeatures(15, + List.of(Map.of("kind", "scrub")), + process(SimpleFeature.create( + newPolygon(0, 0, 0, 1, 1, 1, 0, 0), + new HashMap<>(Map.of("id", "f7254ef8-2649-31e4-9906-1a775dbde15b", + "theme", "base", "type", "land", "subtype", "shrub", "class", "scrub")), + "pm:overture", null, 0))); + + // wetland subtype → wetland kind + // 4d48560e-025b-39fd-b8f3-cd063b166121 + assertFeatures(15, + List.of(Map.of("kind", "wetland")), + process(SimpleFeature.create( + newPolygon(0, 0, 0, 1, 1, 1, 0, 0), + new HashMap<>(Map.of("id", "4d48560e-025b-39fd-b8f3-cd063b166121", + "theme", "base", "type", "land", "subtype", "wetland", "class", "wetland")), + "pm:overture", null, 0))); + + // rock subtype, bare_rock class → bare_rock kind + // e3d2b715-397f-34c3-b534-380dbb732b7b + assertFeatures(15, + List.of(Map.of("kind", "bare_rock")), + process(SimpleFeature.create( + newPolygon(0, 0, 0, 1, 1, 1, 0, 0), + new HashMap<>(Map.of("id", "e3d2b715-397f-34c3-b534-380dbb732b7b", + "theme", "base", "type", "land", "subtype", "rock", "class", "bare_rock")), + "pm:overture", null, 0))); + + // sand subtype, beach class → beach kind + // 78640854-7fdf-36a8-b512-423f41814db8 + assertFeatures(15, + List.of(Map.of("kind", "beach")), + process(SimpleFeature.create( + newPolygon(0, 0, 0, 1, 1, 1, 0, 0), + new HashMap<>(Map.of("id", "78640854-7fdf-36a8-b512-423f41814db8", + "theme", "base", "type", "land", "subtype", "sand", "class", "beach")), + "pm:overture", null, 0))); + } + @Test void testFromTagHighway() { assertFeatures(15,