diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/LoopLineMerger.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/LoopLineMerger.java index 4d1ffa0c95..027ca0c118 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/LoopLineMerger.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/LoopLineMerger.java @@ -86,7 +86,12 @@ private Edge degreeTwoMerge(Node node) { return null; } - private Edge mergeTwoEdges(Node node, Edge a, Edge b) { + private Edge mergeTwoEdges(Node node, Edge edge1, Edge edge2) { + // attempt to preserve segment directions from the original line + // when: A << N -- B then output C reversed from B to A + // when: A >> N -- B then output C from A to B + Edge a = edge1.main ? edge2 : edge1; + Edge b = edge1.main ? edge1 : edge2; node.getEdges().remove(a); node.getEdges().remove(b); List coordinates = new ArrayList<>();