Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix one-way boarding location processing #6388

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.LineString;
Expand Down Expand Up @@ -431,8 +432,9 @@ private void buildBasicGraph() {
normalizer.applyWayProperties(street, backStreet, wayData, way);

platform.ifPresent(plat -> {
osmInfoGraphBuildRepository.addPlatform(street, plat);
osmInfoGraphBuildRepository.addPlatform(backStreet, plat);
for (var s : streets.asIterable()) {
osmInfoGraphBuildRepository.addPlatform(s, plat);
}
});

applyEdgesToTurnRestrictions(way, startNode, endNode, street, backStreet);
Expand Down Expand Up @@ -494,8 +496,8 @@ private void applyEdgesToTurnRestrictions(
OsmWay way,
long startNode,
long endNode,
StreetEdge street,
StreetEdge backStreet
@Nullable StreetEdge street,
@Nullable StreetEdge backStreet
) {
/* Check if there are turn restrictions starting on this segment */
Collection<TurnRestrictionTag> restrictionTags = osmdb.getFromWayTurnRestrictions(way.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nullable;
import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore;
import org.opentripplanner.graph_builder.issues.Graphwide;
import org.opentripplanner.osm.model.OsmWithTags;
Expand Down Expand Up @@ -74,8 +75,8 @@ void applySafetyFactors() {
}

void applyWayProperties(
StreetEdge street,
StreetEdge backStreet,
@Nullable StreetEdge street,
@Nullable StreetEdge backStreet,
WayProperties wayData,
OsmWithTags way
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.opentripplanner.graph_builder.module.osm;

import java.util.ArrayList;
import javax.annotation.Nullable;
import org.opentripplanner.street.model.edge.StreetEdge;

public record StreetEdgePair(StreetEdge main, StreetEdge back) {
public record StreetEdgePair(@Nullable StreetEdge main, @Nullable StreetEdge back) {
/**
* Return the non-null elements of this pair as an Iterable.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,27 @@ public void testBuildGraphDetailed() {
}
}

/**
* There is a one-way road which is also marked as a platform in Sky Campus which crashed OSM
*/
@Test
void testCrappyOsmPlatform() {
var deduplicator = new Deduplicator();
var graph = new Graph(deduplicator);
var osmInfoRepository = new DefaultOsmInfoGraphBuildRepository();
var osmModule = OsmModule
.of(
new OsmProvider(RESOURCE_LOADER.file("sky_campus.osm.pbf"), false),
graph,
osmInfoRepository,
new DefaultVehicleParkingRepository()
)
.withBoardingAreaRefTags(Set.of("naptan:AtcoCode"))
.build();
osmModule.buildGraph();
assertTrue(true);
}

@Test
public void testBuildAreaWithoutVisibility() {
testBuildingAreas(true);
Expand Down
Binary file not shown.
Loading