[postgis-users] Using PostGIS topology to clean-up network prior to routing

Rémi Cura remi.cura at gmail.com
Tue Jul 8 01:34:41 PDT 2014

just a trick I uses to make sure everything will work :

_first check befor that every geom is valid, as a length/area, etc etc
_second if you can node your geom before going ot topology

_when converting to topogeom, uses an order by on your data.
_you can modify to topogeom function to add an exception catcher and
another output (a boolean saying if the conversion worked)
_This way you launch conversion on everything and keep the result, then you
relaunch on errors, and hopefully it will work because the topology is
already containing something.

Yes this is less than clean, but it works for me ...

Now if you have very serious problem: go grass 7, then with 2 command line
you simultaneously import your data into grass and push it to postgis
topology. IF this doesn't work you need a third command line to clean your
topology with grass.
I did it it is easy


2014-07-08 7:53 GMT+02:00 Sandro Santilli <strk at keybit.net>:

> On Mon, Jul 07, 2014 at 05:21:16PM -0300, Adrien ANDRÉ wrote:
> > Thank you, updating PostGIS to 2.2.0dev solved the "shell must be
> > closed" errors.
> >
> > Now "faces mismatch" are dominant :
> >
> >  123 faces mismatch: invalid topology ?
> >   22 SQL/MM Spatial exception - geometry crosses edge
> >    2 Edge changed disposition around end node
> >    1 SQL/MM Spatial exception - geometry crosses a node
> >    1 Spatial exception - geometry intersects edge
> >    1 Edge changed disposition around start node
> >
> >
> > How do i understand them ?
> You read the code:
> https://github.com/postgis/postgis/blob/2.1.3/topology/sql/sqlmm.sql.in#L3553-L3563
> It seems to be a sign of invalid topology being constructed by previous
> steps, so what you could do is have your population routing stop at
> the very first occurrence of any of those errors and check the validity
> of the topology constructed so far, using ValidateTopology.
> Make sure to be running the latest GEOS release, which should also help
> with
> some of those issues. Then, as usual, try to find the smallest set of
> operations that can take you from an empty topology to an invalid topology
> by only using the toTopoGeom function.
> NOTE: order of toTopoGeom calls can change the results.
> NOTE2: tolerance specified can change the results.
> --strk;
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140708/e8cb8ad0/attachment.html>

More information about the postgis-users mailing list