[postgis-users] St_makevalid issue

Paul van der Linden paul.doskabouter at gmail.com
Mon May 4 12:43:31 PDT 2020


Nobody?
Most concerning in my opinion is the instability of st_isvalid when in fact
it is defined as immutable.

I do have it running locally on my machine, fresh postgres/postgis
installation of latest version, and I'm willing to try to debug it.
Only thing I need is what the next step should be...

I also have visual studio so I should be able to put in some debugstuff but
I think I'm going to be needing a bit of help to get that started.

"POSTGIS="3.0.1 3.0.1" [EXTENSION] PGSQL="120" GEOS="3.8.0-CAPI-1.13.1 "
PROJ="Rel. 5.2.0, September 15th, 2018" LIBXML="2.9.9" LIBJSON="0.12"
LIBPROTOBUF="1.2.1" WAGYU="0.4.3 (Internal)""
"PostgreSQL 12.2, compiled by Visual C++ build 1914, 64-bit"
On windows 7 64bit.

SELECT ST_isvalid(simplifiedgeo2),* FROM (
SELECT
    foo2.ne_id,
    foo2.name,
    CASE
        WHEN ST_isvalid(foo2.simplifiedgeo) THEN foo2.simplifiedgeo
        ELSE ST_makevalid(foo2.simplifiedgeo)
    END AS simplifiedgeo2
   FROM (
     SELECT
       ST_simplifypreservetopology(foo.geom,
         LEAST(
           ST_xmax(foo.shiftedgeo::box3d) - ST_xmin(foo.shiftedgeo::box3d),
ST_ymax(foo.shiftedgeo::box3d) - ST_ymin(foo.shiftedgeo::box3d))
         ) AS simplifiedgeo,
       foo.ne_id,
       foo.name,
       foo.geom
     FROM (
        SELECT
          natearth.ne_id,
          natearth.geom,
          natearth.name,
          CASE
              WHEN (
                ST_xmax(ST_shiftlongitude(natearth.geom)::box3d) -
ST_xmin(ST_shiftlongitude(natearth.geom)::box3d))
                <
                (ST_xmax(natearth.geom::box3d) -
ST_xmin(natearth.geom::box3d)
              ) THEN ST_shiftlongitude(natearth.geom)
              ELSE natearth.geom
          END AS shiftedgeo
          FROM (
             SELECT
                ne_10m_admin_0_countries_lakes.ne_id,
                ne_10m_admin_0_countries_lakes.geom,
                ne_10m_admin_0_countries_lakes.name
              FROM ne_10m_admin_0_countries_lakes
          UNION ALL
             SELECT
                ne_10m_admin_1_states_provinces_lakes.ne_id,
                ne_10m_admin_1_states_provinces_lakes.geom,
                ne_10m_admin_1_states_provinces_lakes.name
             FROM ne_10m_admin_1_states_provinces_lakes
          ) natearth
     ) foo
   ) foo2
) as fff
WHERE NOT ST_isvalid(simplifiedgeo2)


P.S. when replying, could you also include my mail address?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200504/4f3d2206/attachment.html>


More information about the postgis-users mailing list