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

List:       postgis-devel
Subject:    Re: [postgis-devel] different result ST_Tesselate from invalid polygon that ST_IsValid says is valid
From:       Tom van Tilburg <tom.van.tilburg () gmail ! com>
Date:       2018-04-25 13:26:11
Message-ID: CAP3PPDhGCbmvGPGZ7BhW+YKw7vbpvWK=zcK1PJ_Kke51RWUXyA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


For the record:
I meant to say that disabling the validity check in sfcgal can dramatically
*de*-crease processing time (not increase).

On Wed, Apr 25, 2018 at 1:36 PM, Nicklas Avén <nicklas.aven@jordogskog.no>
wrote:

> Hello Tom
>
> Thanks a lot. That might be the problem. I see that I have libSFCGAL
> libraries in my /usr/local path so I have probably built it manually
> some time, and probably without validity check. On the server that is
> protesting I use the Debian package.
>
> I will try to build it manually on the server too without validity
> check.
>
> Thanks!
>
> Nicklas
>
>  On Wed, 2018-04-25 at 13:26 +0200, Tom van Tilburg wrote:
> > Hi Nicklas,
> >
> > I have the same issue on "POSTGIS=""2.5.0dev r16509"" [EXTENSION]
> > PGSQL=""100"" GEOS=""3.6.2-CAPI-1.10.2 4d2925d6"" SFCGAL=""1.3.1""
> > PROJ=""Rel. 4.9.3, 15 August 2016"" GDAL=""GDAL 2.2.3, released
> > 2017/11/20"" LIBXML=""2.9.4"" LIBJSON=""0.12.1""
> > LIBPROTOBUF=""1.2.1"" RASTER (sfcgal procs from ""2.5.0dev r16327""
> > need upgrade)"
> >
> > Likely the error comes from the validity check in sfcgal:
> > https://github.com/Oslandia/SFCGAL/blob/561c301a24a76425716ec321d1c5b
> > 2229b9e1bd2/src/algorithm/isValid.cpp#L284
> >
> >
> > I know that during the build-time of sfcgal you can disable the
> > validity-check (which can dramatically increase your processing time)
> > so maybe you have one version where this option has been disabled at
> > build?
> >
> > Best,
> >  Tom
> >
> >
> > On Tue, Apr 24, 2018 at 10:24 PM, Nicklas Avén <nicklas.aven@jordogsk
> > og.no> wrote:
> > > Thanks Martin!
> > >
> > > I realize you of course are right when looking closer on it. It was
> > > all those intersections between the holes and boundary that made me
> > > think so.
> > > But it is actually 3 holes :-)
> > >
> > > Then I guess that the error message comes from libcgal and probably
> > > boost when running st_tesselate.
> > >
> > > So then my confusion moves to why ST_Tesselate works on 1 computor
> > > but not on another with same OS, same versions of PostGIS code.
> > >
> > > I also don't fully understand the error message:
> > > ERROR:  Polygon is invalid : interior is not connected
> > >
> > > Since it is all integer values I don't understand that there should
> > > be any machine dependent differences when judging validity.
> > >
> > > This is about the packaging of TilelessMap. I have to find a better
> > > way of doing the triangulation since, in the end I don't want the
> > > triangle coordinates but just their index in the boundary.
> > >
> > > It is the ugly scripts here that I need to find a way to handle
> > > invalid geometries and ugly geometries like this.
> > > https://github.com/TilelessMap/pg_tileless
> > > Thanks
> > >
> > > Nicklas
> > >
> > >
> > >
> > > On Tue, 2018-04-24 at 12:39 -0700, Martin Davis wrote:
> > > > It's ugly, but it is valid according to SFS rules (which is what
> > > > JTS/GEOS/PostGIS implement).
> > > >
> > > > Why do you think it is not valid?
> > > >
> > > > On Tue, Apr 24, 2018 at 11:48 AM, Nicklas Avén <nicklas.aven@jord
> > > > ogskog.no> wrote:
> > > > > Hello
> > > > >
> > > > > I have an ugly polygon, presented as wkt here below.
> > > > >
> > > > > It is really ugly, and from what I understand it has
> > > > > selfintersection
> > > > > and other things taht I expected ST_Isvalid to react on.
> > > > >
> > > > > But ST_Isvalid let's it through.
> > > > >
> > > > > And on 2 of my PostGIS installations ST_Tesselate gives a
> > > > > reasonable
> > > > > answer. But on a third installation on a virtual machine at
> > > > > Linode I
> > > > > get an error message which I am not sure where it comes from.
> > > > > It says:
> > > > > ERROR:  Polygon is invalid : interior is not connected
> > > > >
> > > > > Does that come from boost?
> > > > >
> > > > > So this is 2 questions:
> > > > >
> > > > > 1) Why doesn't ST_Isvalid tell me it is invalid
> > > > > 2) Where should I search for the different results?
> > > > >
> > > > > As far as I can find I have the exactly same versions on
> > > > > everything on
> > > > > the installs.
> > > > >
> > > > >
> > > > >  POSTGIS="2.5.0dev r16554" [EXTENSION] PGSQL="100"
> > > > > GEOS="3.7.0dev-CAPI-
> > > > > 1.11.0 r" SFCGAL="1.3.0" PROJ="Rel. 4.9.3, 15 August 2016"
> > > > > GDAL="GDAL
> > > > > 2.1.2, released 2016/10/24" LIBXML="2.9.4" LIBJSON="0.12.1"
> > > > > RASTER
> > > > > (1 row)
> > > > >
> > > > > and boost version seems to be the same
> > > > > Package: libboost-system1.62.0
> > > > >
> > > > > Could someone else with sfcgal enabled see what result they
> > > > > get?
> > > > >
> > > > > select st_tesselate(
> > > > > 'POLYGON((389923 6365025,390094 6364730,390269 6364430,390261
> > > > > 6364415,390250 6364399,390239 6364372,390207 6364367,390168
> > > > > 6364372,390136 6364377,390100 6364393,390081 6364429,390070
> > > > > 6364458,390059 6364474,390059 6364494,390044 6364497,390019
> > > > > 6364506,390012 6364512,389985 6364533,389973 6364545,389951
> > > > > 6364567,389931 6364588,389927 6364598,389912 6364628,389907
> > > > > 6364636,389883 6364647,389870 6364649,389863 6364638,389858
> > > > > 6364613,389851 6364591,389817 6364575,389795 6364594,389792
> > > > > 6364625,389791 6364653,389796 6364679,389802 6364695,389811
> > > > > 6364722,389840 6364741,389868 6364741,389882 6364721,389900
> > > > > 6364705,389915 6364699,389915 6364717,389909 6364737,389891
> > > > > 6364770,389885 6364781,389867 6364798,389845 6364810,389823
> > > > > 6364809,389801 6364815,389778 6364822,389761 6364822,389742
> > > > > 6364840,389732 6364863,389741 6364890,389741 6364919,389744
> > > > > 6364920,389760 6364932,389768 6364940,389774 6364954,389776
> > > > > 6364963,389787 6364970,389816 6364981,389852 6364993,389895
> > > > > 6365011,389923 6365025),(390094 6364730,389987 6364914,389981
> > > > > 6364904,389971 6364887,389947 6364869,389921 6364853,389895
> > > > > 6364832,389892 6364816,389906 6364812,389941 6364818,389973
> > > > > 6364827,390021 6364852,390094 6364730),(390094 6364730,390050
> > > > > 6364714,390050 6364713,390094 6364730),(390050 6364714,390034
> > > > > 6364736,390014 6364733,389982 6364724,389954 6364721,389953
> > > > > 6364710,389958 6364695,389964 6364677,389972 6364672,389988
> > > > > 6364673,390015 6364678,390041 6364695,390049 6364713,390047
> > > > > 6364713,390050 6364714))'::geometry);
> > > > >
> > > > >
> > > > > Thanks
> > > > >
> > > > > Nicklas
> > > > >
> > > > > _______________________________________________
> > > > > postgis-devel mailing list
> > > > > postgis-devel@lists.osgeo.org
> > > > > https://lists.osgeo.org/mailman/listinfo/postgis-devel
> > > >
> > > > _______________________________________________
> > > > postgis-devel mailing list
> > > > postgis-devel@lists.osgeo.org
> > > > https://lists.osgeo.org/mailman/listinfo/postgis-devel
> > >
> > > _______________________________________________
> > > postgis-devel mailing list
> > > postgis-devel@lists.osgeo.org
> > > https://lists.osgeo.org/mailman/listinfo/postgis-devel
> >
> > _______________________________________________
> > postgis-devel mailing list
> > postgis-devel@lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/postgis-devel
> _______________________________________________
> postgis-devel mailing list
> postgis-devel@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-devel

[Attachment #5 (text/html)]

<div dir="ltr"><div>For the record:<br></div>I meant to say that disabling the \
validity check in sfcgal can dramatically *de*-crease processing time (not \
increase).<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr \
25, 2018 at 1:36 PM, Nicklas Avén <span dir="ltr">&lt;<a \
href="mailto:nicklas.aven@jordogskog.no" \
target="_blank">nicklas.aven@jordogskog.no</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Hello Tom<br> <br>
Thanks a lot. That might be the problem. I see that I have libSFCGAL<br>
libraries in my /usr/local path so I have probably built it manually<br>
some time, and probably without validity check. On the server that is<br>
protesting I use the Debian package.<br>
<br>
I will try to build it manually on the server too without validity<br>
check.<br>
<br>
Thanks!<br>
<br>
Nicklas<br>
<br>
  On Wed, 2018-04-25 at 13:26 +0200, Tom van Tilburg wrote:<br>
&gt; Hi Nicklas,<br>
&gt; <br>
&gt; I have the same issue on &quot;POSTGIS=&quot;&quot;2.5.0dev r16509&quot;&quot; \
[EXTENSION]<br> &gt; PGSQL=&quot;&quot;100&quot;&quot; \
GEOS=&quot;&quot;3.6.2-CAPI-1.10.2 4d2925d6&quot;&quot; \
SFCGAL=&quot;&quot;1.3.1&quot;&quot;<br> &gt; PROJ=&quot;&quot;Rel. 4.9.3, 15 August \
2016&quot;&quot; GDAL=&quot;&quot;GDAL 2.2.3, released<br> &gt; \
2017/11/20&quot;&quot; LIBXML=&quot;&quot;2.9.4&quot;&quot; \
LIBJSON=&quot;&quot;0.12.1&quot;&quot;<br> &gt; \
LIBPROTOBUF=&quot;&quot;1.2.1&quot;&quot; RASTER (sfcgal procs from \
&quot;&quot;2.5.0dev r16327&quot;&quot;<br> &gt; need upgrade)&quot;<br>
&gt; <br>
&gt; Likely the error comes from the validity check in sfcgal:<br>
&gt; <a href="https://github.com/Oslandia/SFCGAL/blob/561c301a24a76425716ec321d1c5b" \
rel="noreferrer" target="_blank">https://github.com/Oslandia/<wbr>SFCGAL/blob/<wbr>561c301a24a76425716ec321d1c5b</a><br>
 &gt; 2229b9e1bd2/src/algorithm/<wbr>isValid.cpp#L284<br>
&gt; <br>
&gt; <br>
&gt; I know that during the build-time of sfcgal you can disable the<br>
&gt; validity-check (which can dramatically increase your processing time)<br>
&gt; so maybe you have one version where this option has been disabled at<br>
&gt; build?<br>
&gt; <br>
&gt; Best,<br>
&gt;   Tom<br>
&gt; <br>
&gt; <br>
&gt; On Tue, Apr 24, 2018 at 10:24 PM, Nicklas Avén &lt;nicklas.aven@jordogsk<br>
&gt; <a href="http://og.no" rel="noreferrer" target="_blank">og.no</a>&gt; wrote:<br>
&gt; &gt; Thanks Martin!<br>
&gt; &gt; <br>
&gt; &gt; I realize you of course are right when looking closer on it. It was<br>
&gt; &gt; all those intersections between the holes and boundary that made me<br>
&gt; &gt; think so.<br>
&gt; &gt; But it is actually 3 holes :-)<br>
&gt; &gt; <br>
&gt; &gt; Then I guess that the error message comes from libcgal and probably<br>
&gt; &gt; boost when running st_tesselate.<br>
&gt; &gt; <br>
&gt; &gt; So then my confusion moves to why ST_Tesselate works on 1 computor<br>
&gt; &gt; but not on another with same OS, same versions of PostGIS code.<br>
&gt; &gt; <br>
&gt; &gt; I also don&#39;t fully understand the error message:<br>
&gt; &gt; ERROR:    Polygon is invalid : interior is not connected<br>
&gt; &gt; <br>
&gt; &gt; Since it is all integer values I don&#39;t understand that there should<br>
&gt; &gt; be any machine dependent differences when judging validity.<br>
&gt; &gt; <br>
&gt; &gt; This is about the packaging of TilelessMap. I have to find a better<br>
&gt; &gt; way of doing the triangulation since, in the end I don&#39;t want the<br>
&gt; &gt; triangle coordinates but just their index in the boundary.<br>
&gt; &gt; <br>
&gt; &gt; It is the ugly scripts here that I need to find a way to handle<br>
&gt; &gt; invalid geometries and ugly geometries like this.<br>
&gt; &gt; <a href="https://github.com/TilelessMap/pg_tileless" rel="noreferrer" \
target="_blank">https://github.com/<wbr>TilelessMap/pg_tileless</a><br> &gt; &gt; \
Thanks<br> &gt; &gt; <br>
&gt; &gt; Nicklas<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; On Tue, 2018-04-24 at 12:39 -0700, Martin Davis wrote:<br>
&gt; &gt; &gt; It&#39;s ugly, but it is valid according to SFS rules (which is \
what<br> &gt; &gt; &gt; JTS/GEOS/PostGIS implement).<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; Why do you think it is not valid?<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; On Tue, Apr 24, 2018 at 11:48 AM, Nicklas Avén \
&lt;nicklas.aven@jord<br> &gt; &gt; &gt; <a href="http://ogskog.no" rel="noreferrer" \
target="_blank">ogskog.no</a>&gt; wrote:<br> &gt; &gt; &gt; &gt; Hello<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; I have an ugly polygon, presented as wkt here below.<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; It is really ugly, and from what I understand it has<br>
&gt; &gt; &gt; &gt; selfintersection<br>
&gt; &gt; &gt; &gt; and other things taht I expected ST_Isvalid to react on.<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; But ST_Isvalid let&#39;s it through.<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; And on 2 of my PostGIS installations ST_Tesselate gives a<br>
&gt; &gt; &gt; &gt; reasonable<br>
&gt; &gt; &gt; &gt; answer. But on a third installation on a virtual machine at<br>
&gt; &gt; &gt; &gt; Linode I<br>
&gt; &gt; &gt; &gt; get an error message which I am not sure where it comes from.<br>
&gt; &gt; &gt; &gt; It says:<br>
&gt; &gt; &gt; &gt; ERROR:    Polygon is invalid : interior is not connected  <br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; Does that come from boost?<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; So this is 2 questions:<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; 1) Why doesn&#39;t ST_Isvalid tell me it is invalid<br>
&gt; &gt; &gt; &gt; 2) Where should I search for the different results?<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; As far as I can find I have the exactly same versions on<br>
&gt; &gt; &gt; &gt; everything on<br>
&gt; &gt; &gt; &gt; the installs.<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt;   POSTGIS=&quot;2.5.0dev r16554&quot; [EXTENSION] \
PGSQL=&quot;100&quot;<br> &gt; &gt; &gt; &gt; GEOS=&quot;3.7.0dev-CAPI-<br>
&gt; &gt; &gt; &gt; 1.11.0 r&quot; SFCGAL=&quot;1.3.0&quot; PROJ=&quot;Rel. 4.9.3, 15 \
August 2016&quot;<br> &gt; &gt; &gt; &gt; GDAL=&quot;GDAL<br>
&gt; &gt; &gt; &gt; 2.1.2, released 2016/10/24&quot; LIBXML=&quot;2.9.4&quot; \
LIBJSON=&quot;0.12.1&quot;<br> &gt; &gt; &gt; &gt; RASTER<br>
&gt; &gt; &gt; &gt; (1 row)<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; and boost version seems to be the same<br>
&gt; &gt; &gt; &gt; Package: libboost-system1.62.0<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; Could someone else with sfcgal enabled see what result they<br>
&gt; &gt; &gt; &gt; get?<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; select st_tesselate(<br>
&gt; &gt; &gt; &gt; &#39;POLYGON((389923 6365025,390094 6364730,390269 \
6364430,390261<br> &gt; &gt; &gt; &gt; 6364415,390250 6364399,390239 6364372,390207 \
6364367,390168<br> &gt; &gt; &gt; &gt; 6364372,390136 6364377,390100 6364393,390081 \
6364429,390070<br> &gt; &gt; &gt; &gt; 6364458,390059 6364474,390059 6364494,390044 \
6364497,390019<br> &gt; &gt; &gt; &gt; 6364506,390012 6364512,389985 6364533,389973 \
6364545,389951<br> &gt; &gt; &gt; &gt; 6364567,389931 6364588,389927 6364598,389912 \
6364628,389907<br> &gt; &gt; &gt; &gt; 6364636,389883 6364647,389870 6364649,389863 \
6364638,389858<br> &gt; &gt; &gt; &gt; 6364613,389851 6364591,389817 6364575,389795 \
6364594,389792<br> &gt; &gt; &gt; &gt; 6364625,389791 6364653,389796 6364679,389802 \
6364695,389811<br> &gt; &gt; &gt; &gt; 6364722,389840 6364741,389868 6364741,389882 \
6364721,389900<br> &gt; &gt; &gt; &gt; 6364705,389915 6364699,389915 6364717,389909 \
6364737,389891<br> &gt; &gt; &gt; &gt; 6364770,389885 6364781,389867 6364798,389845 \
6364810,389823<br> &gt; &gt; &gt; &gt; 6364809,389801 6364815,389778 6364822,389761 \
6364822,389742<br> &gt; &gt; &gt; &gt; 6364840,389732 6364863,389741 6364890,389741 \
6364919,389744<br> &gt; &gt; &gt; &gt; 6364920,389760 6364932,389768 6364940,389774 \
6364954,389776<br> &gt; &gt; &gt; &gt; 6364963,389787 6364970,389816 6364981,389852 \
6364993,389895<br> &gt; &gt; &gt; &gt; 6365011,389923 6365025),(390094 6364730,389987 \
6364914,389981<br> &gt; &gt; &gt; &gt; 6364904,389971 6364887,389947 6364869,389921 \
6364853,389895<br> &gt; &gt; &gt; &gt; 6364832,389892 6364816,389906 6364812,389941 \
6364818,389973<br> &gt; &gt; &gt; &gt; 6364827,390021 6364852,390094 6364730),(390094 \
6364730,390050<br> &gt; &gt; &gt; &gt; 6364714,390050 6364713,390094 6364730),(390050 \
6364714,390034<br> &gt; &gt; &gt; &gt; 6364736,390014 6364733,389982 6364724,389954 \
6364721,389953<br> &gt; &gt; &gt; &gt; 6364710,389958 6364695,389964 6364677,389972 \
6364672,389988<br> &gt; &gt; &gt; &gt; 6364673,390015 6364678,390041 6364695,390049 \
6364713,390047<br> &gt; &gt; &gt; &gt; 6364713,390050 6364714))&#39;::geometry);<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; Thanks<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; Nicklas<br>
&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; ______________________________<wbr>_________________<br>
&gt; &gt; &gt; &gt; postgis-devel mailing list<br>
&gt; &gt; &gt; &gt; <a \
href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a><br> \
&gt; &gt; &gt; &gt; <a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" \
rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-devel</a><br>
 &gt; &gt; &gt; <br>
&gt; &gt; &gt; ______________________________<wbr>_________________<br>
&gt; &gt; &gt; postgis-devel mailing list<br>
&gt; &gt; &gt; <a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a><br>
 &gt; &gt; &gt; <a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" \
rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-devel</a><br>
 &gt; &gt; <br>
&gt; &gt; ______________________________<wbr>_________________<br>
&gt; &gt; postgis-devel mailing list<br>
&gt; &gt; <a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a><br>
 &gt; &gt; <a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" \
rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-devel</a><br>
 &gt; <br>
&gt; ______________________________<wbr>_________________<br>
&gt; postgis-devel mailing list<br>
&gt; <a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a><br>
 &gt; <a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" \
rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-devel</a><br>
 ______________________________<wbr>_________________<br>
postgis-devel mailing list<br>
<a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" \
target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-devel</a></blockquote></div><br></div>



[Attachment #6 (text/plain)]

_______________________________________________
postgis-devel mailing list
postgis-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-devel

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

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