[OSM-dev] [OSM-talk] Polygons and Multipolygons

Jochen Topf jochen at remote.org
Fri Feb 15 07:46:51 GMT 2008

On Fri, Feb 15, 2008 at 12:28:21AM +0000, Robert (Jamie) Munro wrote:
> Artem Pavlenko wrote:
> | On 8 Feb 2008, at 11:50, Frederik Ramm wrote:
> |
> |> Hi,
> |>
> |>> I found the way term 'Multipolygon' is used in OSM context is
> |>> confusing.
> |> True. What we had been looking for was a term for "polygons with
> |> holes"; it seemed unreasonable to create a relation "type=polygon"
> |> as plain polygons, without holes, don't require relations. But
> |> multipolygon is somewhat of a misnomer.
> |>
> |>> Shouldn't we be calling MultiPolygon  Polygon?
> |> There are only 2788 in the database so it would not be too hard to
> |> change. I wanted to automatically add the "inner" and "outer" flags
> |> to the existing polygons anyway, although they're not strictly
> |> required they would make processing easier for some.
> |
> | I think having 'outer' and 'inner' flags/tags will help at the data
> | entry stage as well.
> Can't we use clockwise / anticlockwise rules? The colour is on the
> right, therefore polygons run clockwise, holes run anti-clockwise,
> islands inside those holes run clockwise again. Under this model, the
> sea is a (normally blue coloured) polygon, and the land is a hole in the
> sea. AFAICT, this is how it is drawn by the renderers at the moment (the
> land colour is just the default rendering background colour).

If we want to have an unambiguous solution we need both, clockwise /
anticlockwise and 'outer' and 'inner' flags/tags. Thats because the
earth is a sphere:

If you think of the shape for a lake. If you don't have a
clockwise/anticlockwise-rule this shape could mean either the lake or
the whole rest of the earth excluding the lake.

In the case with the lake and a hole in it (i.e. an island) it gets
more complicated. You can't say any more whether its supposed to be a
lake with a hole or to disjunct areas.

Of course, in 99.9% of all cases this is not a problem. Currently the
renderers just assume that coordinates with higher numbers are to the
east and north from coordinates with lower numbers and everything works
well. Except if you have things wrapping over the -180/+180 degree line.
This doesn't happen very often though. But I already had some problems
with Mapnik having rendering errors in those cases.

I think a solution should allow people to tag things in a way that they
work properly in pathological cases but also isn't strict if its really
not necessary.

Anyway, all areas without holes can be tagged with a single way, no
relations necessary. So I guess that would already cover 99% of all use

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

More information about the dev mailing list