Include route relations without a network type (#68)

This commit is contained in:
Michael Barry
2022-02-05 06:21:39 -05:00
committed by GitHub
parent 73738dc4a9
commit 60c39b8d8a
2 changed files with 33 additions and 1 deletions

View File

@@ -288,7 +288,7 @@ public class Transportation implements
default -> (relation.hasTag("osmc:symbol") || relation.hasTag("colour")) ? 2 : 3; default -> (relation.hasTag("osmc:symbol") || relation.hasTag("colour")) ? 2 : 3;
}; };
if (networkType != null || rank < 3) { if (network != null || rank < 3) {
return List.of(new RouteRelation(coalesce(ref, ""), network, networkType, (byte) rank, relation.id())); return List.of(new RouteRelation(coalesce(ref, ""), network, networkType, (byte) rank, relation.id()));
} }
} }

View File

@@ -339,6 +339,38 @@ public class TransportationTest extends AbstractLayerTest {
)), features); )), features);
} }
@Test
public void testRouteWithoutNetworkType() {
var rel = new OsmElement.Relation(1);
rel.setTag("type", "route");
rel.setTag("route", "road");
rel.setTag("network", "US:NJ:NJTP");
rel.setTag("ref", "NJTP");
rel.setTag("name", "New Jersey Turnpike (mainline)");
FeatureCollector rendered = process(lineFeatureWithRelation(
profile.preprocessOsmRelation(rel),
Map.of(
"highway", "motorway",
"name", "New Jersey Turnpike",
"ref", "I 95;NJTP"
)));
assertFeatures(13, List.of(mapOf(
"_layer", "transportation",
"class", "motorway",
"_minzoom", 4
), Map.of(
"_layer", "transportation_name",
"class", "motorway",
"name", "New Jersey Turnpike",
"ref", "NJTP",
"ref_length", 4,
"route_1", "US:NJ:NJTP=NJTP",
"_minzoom", 6
)), rendered);
}
@Test @Test
public void testMotorwayJunction() { public void testMotorwayJunction() {
var otherNode1 = new OsmElement.Node(1, 1, 1); var otherNode1 = new OsmElement.Node(1, 1, 1);