Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#5531 closed enhancement (fixed)

There should be way to merge nodes by averaging their position

Reported by: *Martin* Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: merge average Cc:

Description

Currently the place of the merged nodes is the last selected node.

There should be also an option to average positions of all merged nodes.

Adding patch that averages node by node, that is good only if 2 nodes are selected. For 3 or more nodes it is not correct: pos = avg(pos1, avg(pos2, pos3)). The correct should be avg(pos1, pos2, pos3).

I was using this feature when importing from Urban Atlas and was removing tons of gaps caused by roads. When road gap was between forest and farm landuse, I joined both by averaging node pairs along the road gap so the border was in the former gap axis.

Attachments (2)

merge.patch (765 bytes ) - added by *Martin* 14 years ago.
merge-node-averaging.patch (1.5 KB ) - added by *Martin* 14 years ago.

Download all attachments as: .zip

Change History (12)

by *Martin*, 14 years ago

Attachment: merge.patch added

comment:1 by AlfonZ, 14 years ago

Personally, I am used to the way merge works now. I think new command would be more appropriate rather than patching current merge.

comment:2 by *Martin*, 14 years ago

Personally, I am used to the way merge works now. I think new command would be more appropriate rather than patching current merge.

I agree. We need both ways of merging.

comment:3 by stoecker, 14 years ago

You can make it configurable.

comment:4 by *Martin*, 14 years ago

You can make it configurable.

OK, I'll create a patch.

by *Martin*, 14 years ago

Attachment: merge-node-averaging.patch added

comment:5 by *Martin*, 14 years ago

Implemented. The boolean property controlling the averaging is "merge.average-location".

comment:6 by bastiK, 14 years ago

Resolution: fixed
Status: newclosed

In [3596/josm]:

applied #5531 (patch by Martin Ždila) - There should be way to merge nodes by averaging their position

comment:7 by bastiK, 14 years ago

Btw.: if you want exact results you cannot just average lat/lon values, but better use projected coordinates (or some fancy 3D geometry...)

comment:8 by *Martin*, 14 years ago

For me it seems that averaging is OK. LatLon.getCenter uses the same method. If you are sure, could you point me to some article about averaging position on earth?

comment:9 by bastiK, 14 years ago

For small distances (a view meters) the error is negligible. Try to google for "average latitude longitude" to see how the calculation can be improved.

comment:10 by bastiK, 14 years ago

An extreme example to illustrate the problem: Take the two points 70.0 N, 20.0 E and 70.0 N, 160.0 W.

The center is the north pole, but lat/lon average would be on the 70.0 N circle of latitude, so far off.

But for practical use the difference is not noticeable, so we can keep it the way it is now.

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.