[OSM-dev] What exactly is a polygon?

Jochen Topf jochen at remote.org
Thu Nov 6 08:53:41 GMT 2008


On Thu, Nov 06, 2008 at 09:04:01AM +0100, Till Harbaum wrote:
> i am still not sure i fully understand when exactly a way
> a polygon is. What i've learned so far:
> 
> If the first and the last node of a way are identical then the
> way is a polygon, except it's tagged highway, waterway or
> railway.
> 
> What's the purpose of the area tag? Does it make a way
> a polygon, even if the first and last node are not identical?
> Is it used to make highways/waterways or railways a polygon?
> 
> Should my tool automatically tag a way an area if the first
> and last node are identical?
> 
> What about more complex shapes? What if e.g. the first and
> a node in the middle are identical? Is this is polygon with a "tail"?

You can't say that a way is an area without looking und understanding
the combination of all the tags.

The only thing you know for sure is: If the first and last node are not
identical, its not an area. And even that is debatable as you mention in
your "polygon with a tail" example.

And it gets even more complicated with polygons with holes or
multipolygons which need additional relations to model them. So you can
never only look at a way, you also have to check whether there is a
'multipolygon' relation that includes this way. (And, btw. the
'multipolygon' relation is misnamed, because it only models polygons
with holes, not multipolygons.)

So the whole thing is really messy. Everybody is using different ad-hoc
methods to deal with this problem, thats why the renderings of areas
often look different with different renderers.

Jochen
-- 
Jochen Topf  jochen at remote.org  http://www.remote.org/jochen/  +49-721-388298





More information about the dev mailing list