Fix error processing way (#87)

This commit is contained in:
Michael Barry
2023-04-14 05:55:09 -04:00
committed by GitHub
parent d96c612841
commit 6317d82ec9
3 changed files with 43 additions and 1 deletions

View File

@@ -349,6 +349,10 @@ public class Transportation implements
}
int minzoom = getMinzoom(element, highwayClass);
if (minzoom > config.maxzoom()) {
return;
}
boolean highwayRamp = isLink(highway);
Integer rampAboveZ12 = (highwayRamp || element.isRamp()) ? 1 : null;
Integer rampBelowZ12 = highwayRamp ? 1 : null;
@@ -409,7 +413,7 @@ public class Transportation implements
case FieldValues.CLASS_SERVICE -> isDrivewayOrParkingAisle(service(element.service())) ? 14 : 13;
case FieldValues.CLASS_TRACK, FieldValues.CLASS_PATH -> routeRank == 1 ? 12 :
(z13Paths || !nullOrEmpty(element.name()) || routeRank <= 2 || !nullOrEmpty(element.sacScale())) ? 13 : 14;
default -> MINZOOMS.get(baseClass);
default -> MINZOOMS.getOrDefault(baseClass, Integer.MAX_VALUE);
};
}

View File

@@ -253,6 +253,9 @@ public class TransportationName implements
// inherit min zoom threshold from visible road, and ensure we never show a label on a road that's not visible yet.
minzoom = Math.max(minzoom, transportation.getMinzoom(element, highwayClass));
if (minzoom > config.maxzoom()) {
return;
}
FeatureCollector.Feature feature = features.line(LAYER_NAME)
.setBufferPixels(BUFFER_SIZE)

View File

@@ -1280,4 +1280,39 @@ class TransportationTest extends AbstractLayerTest {
"class", "path"
)), collector);
}
@Test
void testIssue86() {
assertFeatures(14, List.of(Map.of(
"_layer", "transportation",
"class", "bridge",
"_minzoom", 13,
"_type", "polygon"
)), process(closedWayFeature(Map.of(
"layer", "1",
"man_made", "bridge",
"service", "driveway"
))));
assertFeatures(14, List.of(Map.of(
"_layer", "transportation",
"class", "bridge",
"_minzoom", 13,
"_type", "polygon"
)), process(closedWayFeature(Map.of(
"layer", "1",
"man_made", "bridge",
"service", "driveway",
"name", "name"
))));
assertFeatures(14, List.of(Map.of(
"_layer", "transportation",
"class", "pier",
"_minzoom", 13,
"_type", "polygon"
)), process(closedWayFeature(Map.of(
"layer", "1",
"man_made", "pier",
"service", "driveway"
))));
}
}