#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)
Change History (12)
by , 14 years ago
Attachment: | merge.patch added |
---|
comment:1 by , 14 years ago
comment:2 by , 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.
by , 14 years ago
Attachment: | merge-node-averaging.patch added |
---|
comment:5 by , 14 years ago
Implemented. The boolean property controlling the averaging is "merge.average-location".
comment:7 by , 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 , 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 , 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 , 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.
Personally, I am used to the way merge works now. I think new command would be more appropriate rather than patching current merge.