[OSM-dev] order of segment list in ways significant?

Etienne 80n80n at gmail.com
Fri Aug 11 10:28:14 BST 2006


Ways are an *ordered* list of segments.

Does the order have any significance?  Sometimes no, sometimes yes;  For
some purposes it is OK to treat a way as a collection of segments, for other
purposes the order is important.

For example, the order of the segments is used by Osmarender to draw the
path along a way which guides the position of the name.

Loops and branches are examples where all segments in a way cannot be
contiguous.  I think the consensus is that roundabouts should be drawn as a
separate way, but branches are often added to ways regardless of continuity.

For an editor it is important that it does not gratuitously alter the order
of the segments in the way.  Some editors, such as JOSM, do not give the
user any feedback about how the segments are ordered, but as far as I can
tell it has the following behaviour (Imi will confirm or deny this):

- Segment order is preserved from download to upload
- When a segment is split, the order of both segments in a way is
preserved.  So A->B->C becomes A->B1->B2->C.
- When a segment is added to way it is *always* added to the end of the
list.

Etienne


On 8/11/06, Michael Strecke <MStrecke at gmx.de> wrote:
>
> After reading various documents, how-tos, and comments I'm still
> wondering if the order in which the segment IDs appear in a way is
> significant or not.
>
> For a programmer this point is important for all operations which add
> segments to a way (e.g. split segment, extend way with segments). Do I
> simply add the ID to the list, or do I have to guess where I have to
> insert it into the list.
>
> Before you say yes, keep in mind:
> - that E- and Y-shaped ways exist, in which case no "natural" order
> scheme exists.
> - that the "oneway" attribute is assigned to segments (and is not
> dependent on the order of the way segment list).
>
> On the other hand, the SQL definition of the OSM database (from SVN)
> suggests some kind of order:
>
> --
> -- Table structure for table `way_segments`
> --
>
> DROP TABLE IF EXISTS `way_segments`;
> CREATE TABLE `way_segments` (
>   `id` bigint(64) NOT NULL default '0',
>   `segment_id` int(11) default NULL,
>   `version` bigint(20) NOT NULL default '0',
>   `sequence_id` bigint(11) NOT NULL auto_increment,
>   PRIMARY KEY  (`id`,`version`,`sequence_id`)
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
>
> Any insights?
>
>
>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20060811/cc10d895/attachment.html>


More information about the dev mailing list