[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] Using PostGIS topology to clean-up network prior to routing
From:       Rémi_Cura <remi.cura () gmail ! com>
Date:       2014-07-08 8:34:41
Message-ID: CAJvUf_vk0gTn0pYVCAJLx4xbRER0Xms7tJ=ABxn7e0qEdrGTzQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hey,
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



Cheers,
R=C3=A9mi-C


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

> On Mon, Jul 07, 2014 at 05:21:16PM -0300, Adrien ANDR=C3=89 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#L=
3553-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 topolog=
y
> 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@lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>

[Attachment #5 (text/html)]

<div dir="ltr"><div><div><div><div>Hey,<br></div>just a trick I uses to make sure \
everything will work :<br><br></div>_first check befor that every geom is valid, as a \
length/area, etc etc<br></div>_second if you can node your geom before going ot \
topology<br> <br></div><div>_when converting to topogeom, uses an order by on your \
data.<br></div><div>_you can modify to topogeom function to add an exception catcher \
and another output (a boolean saying if the conversion worked)<br> _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.<br><br>Yes this is less than clean, but it works for me ...<br> \
</div><div><br></div><div>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&#39;t work you need a third command line to clean your \
topology with grass.<br> </div><div>I did it it is \
easy<br><br><br></div><div><br>Cheers,<br>Rémi-C <br></div></div><div \
class="gmail_extra"><br><br><div class="gmail_quote">2014-07-08 7:53 GMT+02:00 Sandro \
Santilli <span dir="ltr">&lt;<a href="mailto:strk@keybit.net" \
target="_blank">strk@keybit.net</a>&gt;</span>:<br> <blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div \
class="">On Mon, Jul 07, 2014 at 05:21:16PM -0300, Adrien ANDRÉ wrote:<br> &gt; \
Thank you, updating PostGIS to 2.2.0dev solved the &quot;shell must be<br> &gt; \
closed&quot; errors.<br> &gt;<br>
&gt; Now &quot;faces mismatch&quot; are dominant :<br>
&gt;<br>
&gt;   123 faces mismatch: invalid topology ?<br>
&gt;    22 SQL/MM Spatial exception - geometry crosses edge<br>
&gt;      2 Edge changed disposition around end node<br>
&gt;      1 SQL/MM Spatial exception - geometry crosses a node<br>
&gt;      1 Spatial exception - geometry intersects edge<br>
&gt;      1 Edge changed disposition around start node<br>
&gt;<br>
&gt;<br>
&gt; How do i understand them ?<br>
<br>
</div>You read the code:<br>
<a href="https://github.com/postgis/postgis/blob/2.1.3/topology/sql/sqlmm.sql.in#L3553-L3563" \
target="_blank">https://github.com/postgis/postgis/blob/2.1.3/topology/sql/sqlmm.sql.in#L3553-L3563</a><br>
 <br>
It seems to be a sign of invalid topology being constructed by previous<br>
steps, so what you could do is have your population routing stop at<br>
the very first occurrence of any of those errors and check the validity<br>
of the topology constructed so far, using ValidateTopology.<br>
<br>
Make sure to be running the latest GEOS release, which should also help with<br>
some of those issues. Then, as usual, try to find the smallest set of<br>
operations that can take you from an empty topology to an invalid topology<br>
by only using the toTopoGeom function.<br>
<br>
NOTE: order of toTopoGeom calls can change the results.<br>
NOTE2: tolerance specified can change the results.<br>
<div class="HOEnZb"><div class="h5"><br>
--strk;<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" \
target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br> \
</div></div></blockquote></div><br></div>



_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic