<div dir="ltr"><div style="font-size:small" class="gmail_default">> > Any advice on how to further debug this?<br>> <br>> IF you know docker ...<br>> THEN there are some postgis docker images for testing<br>> so you can test your code/data  with different environments easily.<br>> <br>> <a href="https://github.com/postgis/docker-postgis">https://github.com/postgis/docker-postgis</a><br>> -  postgis/postgis:12-master  ( Latest postgis,geos )<br>> <br>> IF "postgis/postgis:12-master"  is OK ,<br>> THEN this is fixed in somewhere ; good news , you have to upgrade your<br>> environment,<br>>            or you can test with different images (  postgis/postgis:11-2.5<br>> )<br>> ELSE - please create a minimal working example[1] and probably somebody<br>> will debug.<br>> <br>> [1] <a href="https://en.wikipedia.org/wiki/Minimal_working_example">https://en.wikipedia.org/wiki/Minimal_working_example</a><br>> <br>> imre<br></div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">I'm really not able to do any upgrades, so that's out of the question</div><div style="font-size:small" class="gmail_default">And the sample below is already the minimum to get that behavior. The inconsistency between runs makes it impossible to pinpoint on one or 2 geometries.</div><div style="font-size:small" class="gmail_default">No experience with docker though<br></div>> <br><div style="font-size:small" class="gmail_default">> Imre Samu <pella.samu at <a href="http://gmail.com">gmail.com</a>> ezt írta (idopont: 2020. márc. 26., Cs,<br>> 17:26):<br>> <br>> > > Doesn't anybody have an idea? Or is at least curious?<br>> > >"POSTGIS="2.5.1 r17027" [EXTENSION] PGSQL="110" GEOS="3.7.0-CAPI-1.11.0<br>> > 3.7.1"<br>> ><br>> > imho: try to update your environment with the latest patches/fixes  and<br>> > please re-check.<br>> > Postgis:  from 2.5.1  -> to 2.5.4 (<br>> > <a href="https://postgis.net/2020/02/28/postgis-2.5.4/">https://postgis.net/2020/02/28/postgis-2.5.4/</a><br>> > <a href="https://git.osgeo.org/gitea/postgis/postgis/raw/tag/2.5.4/NEWS">https://git.osgeo.org/gitea/postgis/postgis/raw/tag/2.5.4/NEWS</a> )<br>> > Geos:  from 3.7.0    ->  to the latest (3.8.1 )  (<br>> > <a href="https://github.com/libgeos/geos/blob/master/NEWS">https://github.com/libgeos/geos/blob/master/NEWS</a> )<br>> ><br>> > Imre<br>> ><br>> > Paul van der Linden <paul.doskabouter at <a href="http://gmail.com">gmail.com</a>> ezt írta (idopont: 2020.<br>> > márc. 26., Cs, 15:54):<br>> ><br>> >> Doesn't anybody have an idea? Or is at least curious?<br>> >><br>> >> Especially the select st_isvalid(geo) where not st_valid returning a<br>> >> "true" row?<br>> >><br>> >> >I have a query that gives inconsistent results.<br>> >> >It almost seems like st_makevalid doesn't always produce the same results<br>> >> >given the same input, and sometimes even returns invalid geometries...<br>> >> ><br>> >> >Results are<br>> >> >f;1159320407;"Bangladesh"<br>> >> >f;1159321073;"Mozambique"<br>> >> >f;1159316737;"Nord"<br>> >> >f;1159314827;"Uusimaa"<br>> >> ><br>> >> >second run:<br>> >> >f;1159321073;"Mozambique"<br>> >> >t;1159315455;"Syddanmark"<br>> >> >t;1159314827;"Uusimaa"<br>> >> >t;1159317795;"Gerona"<br>> >> ><br>> >> >third run:<br>> >> >f;1159321073;"Mozambique"<br>> >> >t;1159315455;"Syddanmark"<br>> >> ><br>> >> >note the 't' in the second and third run...<br>> >> ><br>> >> >Query:<br>> >> ><br>> >> >SELECT ST_isvalid(simplifiedgeo2),* FROM (<br>> >> >SELECT<br>> >> >    foo2.ne_id,<br>> >> >    <a href="http://foo2.name">foo2.name</a>,<br>> >> >    CASE<br>> >> >        WHEN ST_isvalid(foo2.simplifiedgeo) THEN foo2.simplifiedgeo<br>> >> >        ELSE ST_makevalid(foo2.simplifiedgeo)<br>> >> >    END AS simplifiedgeo2<br>> >> >   FROM (<br>> >> >     SELECT<br>> >> >       ST_simplifypreservetopology(foo.geom,<br>> >> >         LEAST(<br>> >> >           ST_xmax(foo.shiftedgeo::box3d) -<br>> >> ST_xmin(foo.shiftedgeo::box3d),<br>> >> >ST_ymax(foo.shiftedgeo::box3d) - ST_ymin(foo.shiftedgeo::box3d))<br>> >> >         ) AS simplifiedgeo,<br>> >> >       foo.ne_id,<br>> >> >       <a href="http://foo.name">foo.name</a>,<br>> >> >       foo.geom<br>> >> >     FROM (<br>> >> >        SELECT<br>> >> >          natearth.ne_id,<br>> >> >          natearth.geom,<br>> >> >          <a href="http://natearth.name">natearth.name</a>,<br>> >> >          CASE<br>> >> >              WHEN (<br>> >> >                ST_xmax(ST_shiftlongitude(natearth.geom)::box3d) -<br>> >> >ST_xmin(ST_shiftlongitude(natearth.geom)::box3d))<br>> >> >                <<br>> >> >                (ST_xmax(natearth.geom::box3d) -<br>> >> >ST_xmin(natearth.geom::box3d)<br>> >> >              ) THEN ST_shiftlongitude(natearth.geom)<br>> >> >              ELSE natearth.geom<br>> >> >          END AS shiftedgeo<br>> >> >          FROM (<br>> >> >             SELECT<br>> >> >                ne_10m_admin_0_countries_lakes.ne_id,<br>> >> >                ne_10m_admin_0_countries_lakes.geom,<br>> >> >                <a href="http://ne_10m_admin_0_countries_lakes.name">ne_10m_admin_0_countries_lakes.name</a><br>> >> >              FROM natural_earth.ne_10m_admin_0_countries_lakes<br>> >> >          UNION ALL<br>> >> >             SELECT<br>> >> >                ne_10m_admin_1_states_provinces_lakes.ne_id,<br>> >> >                ne_10m_admin_1_states_provinces_lakes.geom,<br>> >> >                <a href="http://ne_10m_admin_1_states_provinces_lakes.name">ne_10m_admin_1_states_provinces_lakes.name</a><br>> >> >             FROM natural_earth.ne_10m_admin_1_states_provinces_lakes<br>> >> >          ) natearth<br>> >> >     ) foo<br>> >> >   ) foo2<br>> >> >) as fff<br>> >> >WHERE NOT ST_isvalid(simplifiedgeo2)<br>> >> ><br>> >> >Any advice on how to further debug this?<br>> >> ><br>> >> >"POSTGIS="2.5.1 r17027" [EXTENSION] PGSQL="110" GEOS="3.7.0-CAPI-1.11.0<br>> >> >3.7.1" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.2.4, released<br>> >> >2018/03/19 GDAL_DATA not found" LIBXML="2.7.8" LIBJSON="0.12"<br>> >> >LIBPROTOBUF="1.2.1" (core procs from "2.5.0 r16836" nee (...)"<br>> >> >"PostgreSQL 11.2, compiled by Visual C++ build 1914, 64-bit"<br>> >> ><br>> >> >Running on windows 64-bit.<br><br></div></div>