Skip to content
Draft
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
28 changes: 28 additions & 0 deletions app/src/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions tiles/src/main/java/com/protomaps/basemap/layers/Earth.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
22 changes: 22 additions & 0 deletions tiles/src/main/java/com/protomaps/basemap/layers/Landuse.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
63 changes: 63 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 @@ -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,
Expand Down