[postgis-users] Postgis topology help
Sandro Santilli
strk at keybit.net
Mon Apr 2 00:31:33 PDT 2012
On Sun, Apr 01, 2012 at 12:26:27AM -0700, pcreso at pcreso.com wrote:
> 1. depth contours
> 2. arbitrary lines between contours (generally following a lat or long)
> 3. areas of land or other excluded areas which are excluded from any strata overlapping them.
>
> My current Postgis model defines strata outer boundaries as polygons,
> holes as polygons, & instantiates strata as a set of one or more outer
> boundaries less any holes.
>
> This has the usual issues of slivers & overlaps between strata as
> common boundaries are stored twice, & as not always identical.
>
> If I used topologies, I could store the constituent lines (contours,
> etc) and assemble the outer boundaries from these, to give properly
> normalised polygons.
Yes you could
> I have seen the docs & Strk's presentation, but these to not (to me
> anyway) list the steps to follow to do something like this, & the Postgis
> functions to carry out those steps.
That's because toTopoGeom wasn't yet implemented when I made the
presentations :) I'd need to update those.
The simplest way for you to start would be load all your data into
a topology. The toTopoGeom function should (theoretically) take
care of finding duplicates and reusing existing portions of your
lines and nodes.
Of course if you have slivers & overlaps your resulting topology
would still have additional faces you'll want to drop or gaps you'll
want to fill.
If you're sure about (1) and (2) you could also only add those using
toTopoGeom and then construct (3) "manually" (by defining TopoGeometry
objects using the CreateTopoGeom function. In sql-mm language your
"outer boundaries less any holes" would be "outer face plus inner faces",
ie:
+-----------+ A + B + C == the whole surface you see, with no holes
| A |
| +---+ |
| | B | +-+ |
| +---+ |C| |
| +-+ |
+-----------+
You may notice there are not functions to add or remove elements
(B,C) from TopoGeometry objects. That would be a nice addition for
easier editing of a TopoGeometry composition after creation.
--strk;
,------o-.
| __/ | Delivering high quality PostGIS 2.0 !
| / 2.0 | http://strk.keybit.net - http://vizzuality.com
`-o------'
More information about the postgis-users
mailing list