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

List:       postgis-users
Subject:    [postgis-users] St_makevalid issue
From:       Paul van der Linden <paul.doskabouter () gmail ! com>
Date:       2020-05-04 19:43:31
Message-ID: CAEC-EqCzA6=gXDp5qjEqe6AmEGEuWFssJ4vX-K4N9qOws7E0hA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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?

[Attachment #5 (text/html)]

<div dir="ltr"><div class="gmail_default" style="font-size:small">Nobody?</div><div \
class="gmail_default" style="font-size:small">Most concerning in my opinion is the \
instability of st_isvalid when in fact it is defined as immutable.</div><div \
class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" \
style="font-size:small">I do have it running locally on my machine, fresh \
postgres/postgis installation of latest version, and I&#39;m willing to try to debug \
it.</div><div class="gmail_default" style="font-size:small">Only thing I need is what \
the next step should be...</div><div class="gmail_default" \
style="font-size:small"><br></div><div class="gmail_default" \
style="font-size:small">I also have visual studio so I should be able to put in some \
debugstuff but I think I&#39;m going to be needing a bit of help to get that \
started.<br></div><div class="gmail_default" style="font-size:small"><br></div><div \
class="gmail_default" style="font-size:small"> <pre>&quot;POSTGIS=&quot;3.0.1 \
3.0.1&quot; [EXTENSION] PGSQL=&quot;120&quot; GEOS=&quot;3.8.0-CAPI-1.13.1 &quot; \
PROJ=&quot;Rel. 5.2.0, September 15th, 2018&quot; LIBXML=&quot;2.9.9&quot; \
LIBJSON=&quot;0.12&quot; LIBPROTOBUF=&quot;1.2.1&quot; WAGYU=&quot;0.4.3 \
(Internal)&quot;&quot; &quot;PostgreSQL 12.2, compiled by Visual C++ build 1914, \
64-bit&quot; On windows 7 64bit.</pre>

</div><div class="gmail_default" style="font-size:small">
<pre>SELECT ST_isvalid(simplifiedgeo2),* FROM (
SELECT
    foo2.ne_id,
    <a href="http://foo2.name" target="_blank">foo2.name</a>,
    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,
       <a href="http://foo.name" target="_blank">foo.name</a>,
       foo.geom
     FROM (
        SELECT
          natearth.ne_id,
          natearth.geom,
          <a href="http://natearth.name" target="_blank">natearth.name</a>,
          CASE
              WHEN (
                ST_xmax(ST_shiftlongitude(natearth.geom)::box3d) -
ST_xmin(ST_shiftlongitude(natearth.geom)::box3d))
                &lt;
                (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,
                <a href="http://ne_10m_admin_0_countries_lakes.name" \
target="_blank">ne_10m_admin_0_countries_lakes.name</a>  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,
                <a href="http://ne_10m_admin_1_states_provinces_lakes.name" \
target="_blank">ne_10m_admin_1_states_provinces_lakes.name</a>  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?</pre>

</div></div>


[Attachment #6 (text/plain)]

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/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