[OSM-dev] A proposal for linking multiple ways into a virtual polygon

Jon Burgess jburgess777 at googlemail.com
Tue May 15 19:13:53 BST 2007


It seems we have to accept for now that the number of segments in a way
has to be artificially constrained, how about adding some extra tags to
the ways to allow a tool to easily reconstruct a larger polygon?

What I'm thinking of is essentially a doubly-linked list pointer in the
ways. Each way which forms part of a polygon includes the IDs of the
ways which join on each end, eventually forming a closed loop:

<way id='1' ...>
 <tag k='poly_next' v='2'>
 <tag k='poly_prev' v='5'>
 <seg ... > * 500
</way>

<way id='2' ...>
 <tag k='poly_next' v='3'>
 <tag k='poly_prev' v='1'>
 <seg ... > * 500
</way>

...

<way id='5' ...>
 <tag k='poly_next' v='1'>
 <tag k='poly_prev' v='4'>
 <seg ... > * 500
</way>

This makes it pretty trivial for a tool like mapnik to rejoin ways into
a closed polygon. 

It requires no changes to the API.

Tools like Josm can carry on editing these ways without needing any
explicit support for these tags. 

If desired, Josm or osmarender can be enhanced to recognise these tags
and use them to detect that this is part of a polygon and might need to
handled specially. The ID can be used to allow the adjoining ways to be
downloaded easily. The split way tool could optionally insert these
tags.

	Jon






More information about the dev mailing list