Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#16808 closed defect (wontfix)

Merging two nodes does not preserve the longest history

Reported by: pangoSE Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: merge history Cc:

Description

Hi
Merging two nodes does not always preserve the longest history.
Is it possible to implement this?

Cheers

Attachments (0)

Change History (5)

comment:1 by Don-vip, 7 years ago

Keywords: merge history added

comment:2 by stoecker, 7 years ago

As far as I remember it preserves the history of the oldest node (i.e. lower id).

comment:3 by Don-vip, 7 years ago

Yes:

    /**
     * Find which node to merge into (i.e. which one will be left)
     *
     * @param candidates the collection of candidate nodes
     * @return the selected target node
     */
    public static Node selectTargetNode(Collection<Node> candidates) {
        Node oldestNode = null;
        Node targetNode = null;
        Node lastNode = null;
        for (Node n : candidates) {
            if (!n.isNew()) {
                // Among existing nodes, try to keep the oldest used one
                if (!n.getReferrers().isEmpty()) {
                    if (targetNode == null || n.getId() < targetNode.getId()) {
                        targetNode = n;
                    }
                } else if (oldestNode == null || n.getId() < oldestNode.getId()) {
                    oldestNode = n;
                }
            }
            lastNode = n;
        }
        return Optional.ofNullable(targetNode).orElse(oldestNode != null ? oldestNode : lastNode);
    }

comment:4 by stoecker, 7 years ago

Resolution: wontfix
Status: newclosed

comment:5 by pangoSE, 7 years ago

Perfect.
When I edit and merge nodes I would like JOSM to specify in the changeset in some way that the deleted nodes stem from merging nodes.
Is that possible?
It seems that changesets can have tags when looking at https://www.openstreetmap.org/changeset/63276307

Maybe the changeset tags:
deleted_nodes_from_merging = yes
deleted_nodes_from_merging:procent = 100

or something like that would be suitable.

That way I and tools can easier destinguish edits with a lot of deleted nodes that is not a result of merges.

Version 0, edited 7 years ago by pangoSE (next)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.