private void buildNodes(List<List<Coordinate>> edges) {
    Map<Coordinate, Node> nodes = new HashMap<>();
    for (var coordinateSequence : edges) {
      Coordinate first = coordinateSequence.getFirst();
      Node firstNode = nodes.get(first);
      if (firstNode == null) {
        firstNode = new Node(first);
        nodes.put(first, firstNode);
        output.add(firstNode);
      }

      Coordinate last = coordinateSequence.getLast();
      Node lastNode = nodes.get(last);
      if (lastNode == null) {
        lastNode = new Node(last);
        nodes.put(last, lastNode);
        output.add(lastNode);
      }

      double length = length(coordinateSequence);

      Edge edge = new Edge(firstNode, lastNode, coordinateSequence, length);

      firstNode.addEdge(edge);
      if (firstNode != lastNode) {
        lastNode.addEdge(edge.reversed);
      }
    }
  }
Processes the added geometries and returns the merged linestrings.
<p>
Can be called more than once.
planetiler-core/src/main/java/com/onthegomap/planetiler/util/LoopLineMerger.java