Update to OMT 3.14 (#50)

* initial update step: 3.13.1 bumped to 3.14

* automated update steps: regenerate-openmaptiles.sh v3.14 + mvn spotless:apply

* riverbank was removed from waterway -> replaced with dock un the unit test

* riverbank was removed from waterway -> testRiverbank() changed into testDock()

* riverbank was removed in OpenMapTiles v3.14

* parcel_locker (with brand, operator and/or ref) was added in OpenMapTiles v3.14

* bus_guideway was added in OpenMapTiles v3.14

* support for county seats (capital=6) was added in OpenMapTiles v3.14

* spotless:apply

* gn_ascii replaced with name_en

gn_ascii was removed from NE5 - see commit b14da2ea in OMT for more
details

* merging of buildings at Z13 replicated also for landuse from Z9 (or for some from Z6) to Z13 to match updates in OpenMapTiles v3.14

* landuse_merge_z9_to_z13 argument removed since it has negligible perf. overhead hence no need to have it

* cover a corner case for parcel_locker: no brand, no operator, just ref

* corrected landuse polygon merging to better match OpenMapTiles 3.14 (1)

* corrected landuse polygon merging to better match OpenMapTiles 3.14 (1): merge only landuse=residential

* clean-up: since evaluation in Landuse is simpler than in Landcover, streaming and Collectors.partitioningBy() used

* clean-up of naming: splitList -> splitLists

* land-use merging unit test adjusted and extended to match recent changes

* other unit tests adjusted to match recent changes

* spotless:apply

* clean-up: added comment, to match Landover

* 3.13.1 bumped to 3.14 (follow-up/fix for e26e13a6f)

* adjusted WOOD_OR_FOREST handling for Z8 to match change in OMT (osm_landcover_gen_z8)

* updated unit test to match adjusted WOOD_OR_FOREST handling for Z8

* clean-up: if-else replaced with switch

* clean-up: conditional grouped to make it more readable
This commit is contained in:
Peter Hanecak
2022-12-28 13:36:12 +01:00
committed by GitHub
parent d378521372
commit c662ef2d30
18 changed files with 400 additions and 146 deletions

View File

@@ -171,17 +171,17 @@ class LandcoverTest extends AbstractLayerTest {
}
@Test
void testMergeNonForestsBelowZ9() throws GeometryException {
void testMergeNonForestsBelowZ8() throws GeometryException {
Map<String, Object> map = Map.of("subclass", "dune");
assertMerges(List.of(map, map), List.of(
feature(rectangle(10, 20), Map.of("_numpoints", 48, "subclass", "dune")),
feature(rectangle(12, 18), Map.of("_numpoints", 301, "subclass", "dune"))
), 9);
), 8);
assertMerges(List.of(map), List.of(
feature(rectangle(10, 20), Map.of("_numpoints", 48, "subclass", "dune")),
feature(rectangle(12, 18), Map.of("_numpoints", 301, "subclass", "dune"))
), 8);
), 7);
assertMerges(List.of(map, map), List.of(
feature(rectangle(10, 20), Map.of("_numpoints", 48, "subclass", "dune")),
feature(rectangle(12, 18), Map.of("_numpoints", 301, "subclass", "dune"))

View File

@@ -2,10 +2,13 @@ package org.openmaptiles.layers;
import static com.onthegomap.planetiler.TestUtils.rectangle;
import com.onthegomap.planetiler.VectorTile;
import com.onthegomap.planetiler.geo.GeoUtils;
import com.onthegomap.planetiler.geo.GeometryException;
import com.onthegomap.planetiler.reader.SimpleFeature;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.openmaptiles.OpenMapTilesProfile;
@@ -86,9 +89,43 @@ class LanduseTest extends AbstractLayerTest {
"class", "residential",
"_minzoom", 6,
"_maxzoom", 14,
"_minpixelsize", 2d
"_minpixelsize", 0.1d
)), process(polygonFeature(Map.of(
"landuse", "residential"
))));
}
@Test
void testMergePolygonsZ12() throws GeometryException {
var poly1 = new VectorTile.Feature(
Landuse.LAYER_NAME,
1,
VectorTile.encodeGeometry(rectangle(10, 20)),
Map.of("class", "residential"),
0
);
var poly2 = new VectorTile.Feature(
Landuse.LAYER_NAME,
1,
VectorTile.encodeGeometry(rectangle(20, 10, 22, 20)),
Map.of("class", "residential"),
0
);
var poly3 = new VectorTile.Feature(
Landuse.LAYER_NAME,
1,
VectorTile.encodeGeometry(rectangle(10, 20, 20, 22)),
Map.of("class", "suburb"),
0
);
Assertions.assertEquals(
3,
profile.postProcessLayerFeatures(Landuse.LAYER_NAME, 13, List.of(poly1, poly2, poly3)).size()
);
Assertions.assertEquals(
2,
profile.postProcessLayerFeatures(Landuse.LAYER_NAME, 12, List.of(poly1, poly2, poly3)).size()
);
}
}

View File

@@ -430,6 +430,81 @@ class PlaceTest extends AbstractLayerTest {
))));
}
@Test
void testCountyCapital() {
process(SimpleFeature.create(
newPoint(0, 0),
Map.of(
"name", "Pueblo",
"scalerank", 7,
"wikidataid", "Q675576"
),
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
"ne_10m_populated_places",
0
));
assertFeatures(0, List.of(Map.of(
"_layer", "place",
"class", "city",
"name", "Pueblo",
"rank", 7,
"capital", 6,
"_type", "point",
"_minzoom", 6
)), process(pointFeature(
Map.of(
"place", "city",
"name", "Pueblo",
"population", "111876",
"capital", "6"
))));
// no match when far away
assertFeatures(0, List.of(Map.of(
"_layer", "place",
"class", "city",
"name", "Pueblo",
"rank", "<null>"
)), process(SimpleFeature.create(
newPoint(1, 1),
Map.of(
"place", "city",
"name", "Pueblo",
"wikidata", "Q675576",
"population", "111876",
"capital", "6"
),
OpenMapTilesProfile.OSM_SOURCE,
null,
0
)));
// unaccented name match
assertFeatures(0, List.of(Map.of(
"_layer", "place",
"class", "city",
"rank", 7
)), process(pointFeature(
Map.of(
"place", "city",
"name", "Pueblo",
"population", "111876",
"capital", "6"
))));
// wikidata only match
assertFeatures(0, List.of(Map.of(
"_layer", "place",
"class", "city",
"rank", 7
)), process(pointFeature(
Map.of(
"place", "city",
"name", "Other name",
"population", "111876",
"wikidata", "Q675576",
"capital", "6"
))));
}
@Test
void testCityWithoutNaturalEarthMatch() {

View File

@@ -236,4 +236,42 @@ class PoiTest extends AbstractLayerTest {
"network", "ATM name"
))));
}
@Test
void testParcelLocker() {
List<Map<String, Object>> expected = List.of(Map.of(
"_layer", "poi",
"class", "post",
"subclass", "parcel_locker",
"name", "Parcel Locker name"
));
assertFeatures(14, expected, process(pointFeature(Map.of(
"amenity", "parcel_locker",
"brand", "Parcel Locker name"
))));
assertFeatures(14, expected, process(pointFeature(Map.of(
"amenity", "parcel_locker",
"operator", "Parcel Locker name"
))));
assertFeatures(14, expected, process(pointFeature(Map.of(
"amenity", "parcel_locker",
"operator", "Parcel Locker",
"ref", "name"
))));
}
@Test
void testParcelLockerCornerCase() {
List<Map<String, Object>> expected = List.of(Map.of(
"_layer", "poi",
"class", "post",
"subclass", "parcel_locker",
"name", "Corner Case"
));
// no brand, no operator, just ref
assertFeatures(14, expected, process(pointFeature(Map.of(
"amenity", "parcel_locker",
"ref", "Corner Case"
))));
}
}

View File

@@ -724,6 +724,29 @@ class TransportationTest extends AbstractLayerTest {
))));
}
@Test
void testBusGuideway() {
assertFeatures(13, List.of(Map.of(
"_layer", "transportation",
"class", "bus_guideway",
"brunnel", "tunnel",
"_minzoom", 11
), Map.of(
"_layer", "transportation_name",
"class", "bus_guideway",
"name", "Silver Line",
"_minzoom", 12
)), process(lineFeature(Map.of(
"access", "no",
"bus", "yes",
"highway", "bus_guideway",
"layer", "-1",
"name", "Silver Line",
"trolley_wire", "yes",
"tunnel", "yes"
))));
}
final OsmElement.Relation relUS = new OsmElement.Relation(1);
{

View File

@@ -144,20 +144,27 @@ class WaterTest extends AbstractLayerTest {
"natural", "water",
"covered", "yes"
))));
assertFeatures(14, List.of(Map.of(
"class", "river",
"brunnel", "bridge",
"intermittent", 1,
assertFeatures(14, List.of(
Map.of(
"class", "dock",
"intermittent", 1,
"_layer", "water",
"_type", "polygon",
"_minzoom", 6,
"_maxzoom", 14
)), process(polygonFeature(Map.of(
"waterway", "riverbank",
"bridge", "1",
"intermittent", "1"
))));
"_layer", "water",
"_type", "polygon",
"_minzoom", 6,
"_maxzoom", 14),
Map.of(
"class", "harbor",
"subclass", "dock",
"_layer", "poi",
"_type", "point",
"_minzoom", 14,
"_maxzoom", 14
)), process(polygonFeature(Map.of(
"waterway", "dock",
"intermittent", "1"
))));
assertFeatures(11, List.of(Map.of(
"class", "lake",
"brunnel", "<null>",
@@ -175,14 +182,19 @@ class WaterTest extends AbstractLayerTest {
}
@Test
void testRiverbank() {
assertFeatures(11, List.of(Map.of(
"class", "river",
"_layer", "water",
"_type", "polygon"
)), process(polygonFeature(Map.of(
"waterway", "riverbank"
))));
void testDock() {
assertFeatures(11, List.of(
Map.of(
"class", "dock",
"_layer", "water",
"_type", "polygon"),
Map.of(
"class", "harbor",
"_layer", "poi",
"_type", "point"
)), process(polygonFeature(Map.of(
"waterway", "dock"
))));
}
@Test