[OSM-talk] Splitting and merging ways (was Re: road on western side of Loch Ness)
Richard Fairhurst
richard at systemeD.net
Wed Dec 6 14:31:31 GMT 2006
Quoting matthew-osm at newtoncomputing.co.uk:
> Just out of interest, what happens if you try to split a way that
>
> * contains cycles (loops); or
> * is disjoint?
>
> As you know, because a way is purely an ordered list of segments, with no
> constraints on connectivity or otherwise, these are entirely
> possible. (If a way was an ordered list of nodes, of course, it would
> make this easier.)
>
> I would guess that an error is given?
Ok. Essentially the idea behind Potlatch is to create a simple
newbie-friendly editor (which we don't have yet), as opposed to a
power-user editor (which we already have). The main thrust of this is
that segments are never exposed to the user: it's ways and nodes alone.
Consequently, you can't use Potlatch to draw a new line with loops
(except in the special case of first node=last node) or disjoints -
you'll need to use JOSM for that. However, given that there are lots
of loops and disjoints in existing OSM data and it mustn't break
these, Potlatch does attempt to support these within the limitations
of the UI.
If we have a way
A--B--C--D E--F--G
(i.e. disjoint between D and E) and split it at C, the result is:
way 1: A--B--C
way 2: C--D E--F--G
(The key/values of the original way will be copied to both new ways.)
Loops are fairly similar. If we have:
F--E
| |
A--B--C--D
|
G
and split at E, the result is one A-B-C-D-E way, another E-F-C-G.
If we split at C, it will assume splitting at the first instance; the
result will be one A-B-C and another C-D-E-F-C-G.
You didn't ask, but I might as well explain merging ways, because the
limitation is more obvious here. If you have two ways:
way 1: A--B--C
way 2: D--E--F
then you can merge them by drawing a connecting line from C to D. Easy enough.
But if you have two disjoint ways:
way 1: A--B--C D--E--F
way 2: G--H--I
you can't join C to G. It will only work for the first or last node in
a way, not for any intermediate nodes. This does therefore require
that the source segments are well-ordered until I implement a "reorder
segments" option (which won't be in the first release).
Unfortunately it doesn't yet have a "render way as ASCII art for
mailing list message" option... I think that's more a JOSM power-user
thing. :)
cheers
Richard
More information about the talk
mailing list