Fix pedestrian area multipolygons (#63)

This commit is contained in:
Michael Barry
2022-01-27 06:14:37 -05:00
committed by GitHub
parent 57323485ce
commit 650f68455e
3 changed files with 40 additions and 5 deletions

View File

@@ -131,6 +131,17 @@ public abstract class AbstractLayerTest {
);
}
SourceFeature closedWayFeature(Map<String, Object> props) {
return SimpleFeature.createFakeOsmFeature(
newLineString(0, 0, 1, 0, 1, 1, 0, 1, 0, 0),
new HashMap<>(props),
OSM_SOURCE,
null,
0,
null
);
}
SourceFeature polygonFeatureWithArea(double area, Map<String, Object> props) {
return SimpleFeature.create(
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(area))),

View File

@@ -990,7 +990,7 @@ public class TransportationTest extends AbstractLayerTest {
@Test
public void testPedestrianArea() {
assertFeatures(10, List.of(Map.of(
Map<String, Object> pedestrianArea = Map.of(
"_layer", "transportation",
"class", "path",
"subclass", "pedestrian",
@@ -998,13 +998,36 @@ public class TransportationTest extends AbstractLayerTest {
"_minzoom", 13,
"_maxzoom", 14,
"_type", "polygon"
)), process(polygonFeature(Map.of(
);
Map<String, Object> circularPath = Map.of(
"_layer", "transportation",
"class", "path",
"subclass", "pedestrian",
"_minzoom", 14,
"_maxzoom", 14,
"_type", "line"
);
assertFeatures(14, List.of(pedestrianArea), process(closedWayFeature(Map.of(
"highway", "pedestrian",
"area", "yes",
"foot", "yes"
))));
assertFeatures(14, List.of(pedestrianArea), process(polygonFeature(Map.of(
"highway", "pedestrian",
"foot", "yes"
))));
assertFeatures(14, List.of(circularPath), process(closedWayFeature(Map.of(
"highway", "pedestrian",
"foot", "yes"
))));
assertFeatures(14, List.of(circularPath), process(closedWayFeature(Map.of(
"highway", "pedestrian",
"foot", "yes",
"area", "no"
))));
// ignore underground pedestrian areas
assertFeatures(10, List.of(),
assertFeatures(14, List.of(),
process(polygonFeature(Map.of(
"highway", "pedestrian",
"area", "yes",