Fix oneway logic (#70)

This commit is contained in:
Michael Barry
2023-02-06 05:48:51 -05:00
committed by GitHub
parent 0a27d5b309
commit 30538c6706
3 changed files with 11 additions and 2 deletions

View File

@@ -527,7 +527,7 @@ public class Transportation implements
int onewayId = 1;
for (var item : items) {
var oneway = item.attrs().get(Fields.ONEWAY);
if (oneway instanceof Integer i && ONEWAY_VALUES.contains(i)) {
if (oneway instanceof Number n && ONEWAY_VALUES.contains(n.intValue())) {
item.attrs().put(LIMIT_MERGE_TAG, onewayId++);
}
}

View File

@@ -200,7 +200,7 @@ class OpenMapTilesTest {
), 14, 909, LineString.class);
assertNumFeatures("transportation", Map.of(
"class", "primary"
), 14, 170, LineString.class);
), 14, 259, LineString.class);
}
@Test

View File

@@ -986,6 +986,15 @@ class TransportationTest extends AbstractLayerTest {
testDoesNotMergeLinestrings(Map.of("class", "motorway", "oneway", -1), layer, 10, 14);
}
@Test
void testMergesDisconnectedRoadFeaturesUnlessOnewayLong() throws GeometryException {
String layer = Transportation.LAYER_NAME;
testMergesLinestrings(Map.of("class", "motorway", "oneway", 0L), layer, 10, 14);
testMergesLinestrings(Map.of("class", "motorway"), layer, 10, 14);
testDoesNotMergeLinestrings(Map.of("class", "motorway", "oneway", 1L), layer, 10, 14);
testDoesNotMergeLinestrings(Map.of("class", "motorway", "oneway", -1L), layer, 10, 14);
}
@Test
void testLightRail() {
assertFeatures(13, List.of(Map.of(