[postgis-devel] Topology in PostGIS

Sandro Santilli strk at keybit.net
Tue Apr 29 00:54:25 PDT 2014

[ replying to postgis-devel ]

On Mon, Apr 28, 2014 at 11:59:08AM +0200, Tomislav Obad wrote:
> Hi Sandro,
> I work on one public project in Croatia which basically includes
> maintenance of administrative units. The web based system will be developed
> on opensource, namely PostgreSQL database, Geoserver and Java on middle
> layer.
> Since topological model is appropriate for that kind of dataset, we're
> considering usage of PostGIS Topology. Another options are that we build
> custom topology mechanism with usage of pgplsgl procedures or that we use
> simple feature objects and simulate simultaneous modification of boundaries
> (e.g. when user changes country boundary, all bellow boundaries should be
> changed (county, municipality, settlement, etc.)).

I think it would make more sense to build tools over the existing PostGIS
Topology. You might find limits but would then be a better investiment
to extend the existing support.

> I wouldn't bother you in case when number of usage examples would be
> available, but this is not the case. Only thing I could find was your
> presentation for some conference in Rome in 2011 and topology reference (
> http://postgis.refractions.net/docs/Topology.html). I've reproduced your
> example in database and qgis, but when I've moved a node, the edges and
> faced didn't adjust/change. Maybe I've missunderstood the concept.

The ISO specifications have no provision for a function to move non-isolated
nodes, and PostGIS Topology doesn't have its own implementation of that.

> I don't feel confident to use it in that form, so I was wondering if you
> could provide some additional info or experience and your general feeling
> if the topology in postgis is mature enough for that purpose. If I'm not
> wrong, you're the main developer for that module, or one of the developers.

Generally, none of these operations are expected to be supported transparently
but rather there are functions to use for taking care of consistency.
An example is the ISO standard ST_ChangeEdgeGeom [1], which does not allow
the edge movement to change the topology structure.

[1] http://postgis.net/docs/ST_ChangeEdgeGeom.html

What you might need would be a MoveNode function allowing moving non-isolated
nodes. Such function should likely take care of ensuring topology consistency.
Example of movements that should probably be forbidden:

       o       o
      /|       |\        This movement would change the right/left
     / |e1   e1| \       faces for edge e1, which is not even directly
 n1 o  |  -->  |  o n1   connected to node n1. 
     \ |       | /
      \|       |/
       o       o

I'd love to see a draft implementation of such function.
Ideally it'd be written directly in plpgsql to become part of the core.
Alternatively (or as a prototype) could be written outside, for example
as part of the qgis editor for postgis topologies [2]

[2] https://github.com/strk/qgis_pgis_topoedit

I'll be happy to help if you decide to take one of those paths.


 ()  ASCII ribbon campaign  --  Keep it simple !
 /\  http://strk.keybit.net/rants/ascii_mails.txt  

More information about the postgis-devel mailing list