|
Geometry : |
Subject: [ggl] Storing the topology of a Polygon
From: Barend Gehrels (barend)
Date: 2011-07-20 20:03:53
Hi Mats,
On 20-7-2011 20:26, Mats Taraldsvik wrote:
> Hi,
>
> Often in GIS systems, complex geometries (such as polygons), are
> (also) stored as simpler objects (linestrings, circularstrings) to
> reduce redundancy and maintain topology.
Yes, some do it like this, for example, ESRI coverages. Most (most
spatial databases, shapefiles, MapInfo) do not do this anymore.
>
> (from the docs, if I read them correctly:)
>
> * a Polygon contains/points to Rings and Points
> * a Ring (only) contains/points to Points
Right. These are the provided models. But more is possible.
>
> - A Ring is constructed from at least one linestring, I can't maintain
> the topology without that information (i.e. identify common linestrings).
>
> Ideally, I would save two polygons + topology by looping through them,
> looping through their rings, and finally looping through the
> linestrings of each ring. If the two polygons share one of the
> linestrings, I need to store this once, and when a Ring
> contains/points to the linestrings it is constructed from, this is
> trivial. (The result: A modification in this shared linestring is
> refleced in both polygons.)
Boost.Geometry does not offer topology out of the box. However, it does
offer concepts. So a Ring is is a vector of points, but you can attach
information to it. You can create your own models (including topologic
information, ID's, SRID, names, etc etc) and register this or adapt this
to the concepts. It will then work with Boost.Geometry.
Besides this, if your model (e.g. a Ring) implements Boost.Range, you
can create a ring which consists of linestrings of multiple sources. So
you can share those linestrings. This will be much more complex to
implement, and to be honest, exactly this I've never implemented or
worked out, but I think it should be feasable. As long as it provides
Boost.Range behaviour, and is registered with Boost.Geometry, it will work.
Good point. I'm curious.
Regards, Barend
Geometry list run by mateusz at loskot.net