mirror of
https://github.com/cfpwastaken/planetiler-openmaptiles.git
synced 2026-02-04 12:31:10 +00:00
Fix oneway logic (#70)
This commit is contained in:
@@ -527,7 +527,7 @@ public class Transportation implements
|
|||||||
int onewayId = 1;
|
int onewayId = 1;
|
||||||
for (var item : items) {
|
for (var item : items) {
|
||||||
var oneway = item.attrs().get(Fields.ONEWAY);
|
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++);
|
item.attrs().put(LIMIT_MERGE_TAG, onewayId++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ class OpenMapTilesTest {
|
|||||||
), 14, 909, LineString.class);
|
), 14, 909, LineString.class);
|
||||||
assertNumFeatures("transportation", Map.of(
|
assertNumFeatures("transportation", Map.of(
|
||||||
"class", "primary"
|
"class", "primary"
|
||||||
), 14, 170, LineString.class);
|
), 14, 259, LineString.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -986,6 +986,15 @@ class TransportationTest extends AbstractLayerTest {
|
|||||||
testDoesNotMergeLinestrings(Map.of("class", "motorway", "oneway", -1), layer, 10, 14);
|
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
|
@Test
|
||||||
void testLightRail() {
|
void testLightRail() {
|
||||||
assertFeatures(13, List.of(Map.of(
|
assertFeatures(13, List.of(Map.of(
|
||||||
|
|||||||
Reference in New Issue
Block a user