Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#11302 closed defect (fixed)

"distribute nodes" acts weirdly if the way is not reasonably straight already

Reported by: richlv Owned by: team
Priority: normal Milestone: 15.04
Component: Core Version: tested
Keywords: distribute_nodes Cc:


see the attached testcase. select the way, hit shift+b. instead of being distributed evenly, nodes are distributed "somehow" :)
seems to be caused by they way going "backwards" ?

note that this is different from ticket #6385 - changing to line here is ok, but the nodes are not distributed evenly.

josm 8159

Attachments (1)

distribute_nodes_testcase.osm (655 bytes) - added by richlv 9 years ago.

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by richlv

comment:1 Changed 9 years ago by richlv

ok, just in case somebody else is interested in this, there is a workaround :)

  1. cut the way so that the segment you want to distribute the nodes in is a separate way
  2. select the desired segment, hit l (line) - possibly select nodes to control how the line is formed
  3. at both ends of the new way, draw 2-node segments, ending these at the ends of the target way
  4. select the nodes that join these 3 ways one by one and hit g (unglue)
  5. slightly move one of the nodes in the way, select the target way and hit o (align in circle)
  6. on both ends, select the moved endpoint and the end of the small temporary way, hit 'm'
  7. select the target way and hit l again to straighten out any slight circleness that resulted from 'o'
  8. remove temporary ways

the trick here is even distribution that is performed by "align in circle". temporary ways offer a way to keep start/end nodes exactly where they were.

this is not perfect as the distribution at both ends of the way is slightly off (because of that moving), but that's still much closer to a good result :)

Last edited 9 years ago by richlv (previous) (diff)

comment:2 Changed 9 years ago by Balaitous

I look at the source code.

The algorithm does not take into account the order of nodes when a way is selected.
So I propose to keep nodes order when one way is selected.
If one or two nodes of this way are also selected, these nodes should be fix.

No changes in other cases.

comment:3 Changed 9 years ago by Balaitous

Resolution: fixed
Status: newclosed

In 8247/josm:

fix #11302 - "distribute nodes" acts weirdly if the way is not reasonably straight already

When one way (no self-crossing) is selected with at most two of its nodes, distibute node keeping nodes order along the way. Selected nodes are kept in place.
In any other case, no changes are made to the algorithm.

comment:4 Changed 9 years ago by Don-vip

Milestone: 15.04


comment:5 Changed 9 years ago by anonymous

looks like with latest-8248, if a way is selected (without any nodes), all nodes are distributed equally and the way is straightened out between the first and the last node of the way - which is perfect for me, huge thanks :)

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.