Skip to content

Commit

Permalink
Isochrones: Reduce number of different sites for edge-based routing
Browse files Browse the repository at this point in the history
  • Loading branch information
easbar committed Oct 23, 2024
1 parent cc45cf0 commit 49139dd
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public Result triangulate(Snap snap, QueryGraph queryGraph, ShortestPathTree sho
PointList innerPoints = edge.fetchWayGeometry(FetchMode.PILLAR_ONLY);
if (innerPoints.size() > 0) {
int midIndex = innerPoints.size() / 2;
if (innerPoints.size() % 2 == 0 && edge.get(EdgeIteratorState.REVERSE_STATE))
// For edge-based routing we might have explored the same edge in two different directions.
// Here we make sure we only include the **same** point twice instead of two different ones.
midIndex -= 1;
double lat2 = innerPoints.getLat(midIndex);
double lon2 = innerPoints.getLon(midIndex);
Coordinate site2 = new Coordinate(lon2, lat2);
Expand Down

0 comments on commit 49139dd

Please sign in to comment.