[postgis-users] St_makevalid issue
Imre Samu
pella.samu at gmail.com
Thu Mar 26 09:59:53 PDT 2020
> Any advice on how to further debug this?
IF you know docker ...
THEN there are some postgis docker images for testing
so you can test your code/data with different environments easily.
https://github.com/postgis/docker-postgis
- postgis/postgis:12-master ( Latest postgis,geos )
IF "postgis/postgis:12-master" is OK ,
THEN this is fixed in somewhere ; good news , you have to upgrade your
environment,
or you can test with different images ( postgis/postgis:11-2.5
)
ELSE - please create a minimal working example[1] and probably somebody
will debug.
[1] https://en.wikipedia.org/wiki/Minimal_working_example
imre
Imre Samu <pella.samu at gmail.com> ezt írta (időpont: 2020. márc. 26., Cs,
17:26):
> > Doesn't anybody have an idea? Or is at least curious?
> >"POSTGIS="2.5.1 r17027" [EXTENSION] PGSQL="110" GEOS="3.7.0-CAPI-1.11.0
> 3.7.1"
>
> imho: try to update your environment with the latest patches/fixes and
> please re-check.
> Postgis: from 2.5.1 -> to 2.5.4 (
> https://postgis.net/2020/02/28/postgis-2.5.4/
> https://git.osgeo.org/gitea/postgis/postgis/raw/tag/2.5.4/NEWS )
> Geos: from 3.7.0 -> to the latest (3.8.1 ) (
> https://github.com/libgeos/geos/blob/master/NEWS )
>
> Imre
>
> Paul van der Linden <paul.doskabouter at gmail.com> ezt írta (időpont: 2020.
> márc. 26., Cs, 15:54):
>
>> Doesn't anybody have an idea? Or is at least curious?
>>
>> Especially the select st_isvalid(geo) where not st_valid returning a
>> "true" row?
>>
>> >I have a query that gives inconsistent results.
>> >It almost seems like st_makevalid doesn't always produce the same results
>> >given the same input, and sometimes even returns invalid geometries...
>> >
>> >Results are
>> >f;1159320407;"Bangladesh"
>> >f;1159321073;"Mozambique"
>> >f;1159316737;"Nord"
>> >f;1159314827;"Uusimaa"
>> >
>> >second run:
>> >f;1159321073;"Mozambique"
>> >t;1159315455;"Syddanmark"
>> >t;1159314827;"Uusimaa"
>> >t;1159317795;"Gerona"
>> >
>> >third run:
>> >f;1159321073;"Mozambique"
>> >t;1159315455;"Syddanmark"
>> >
>> >note the 't' in the second and third run...
>> >
>> >Query:
>> >
>> >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 natural_earth.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 natural_earth.ne_10m_admin_1_states_provinces_lakes
>> > ) natearth
>> > ) foo
>> > ) foo2
>> >) as fff
>> >WHERE NOT ST_isvalid(simplifiedgeo2)
>> >
>> >Any advice on how to further debug this?
>> >
>> >"POSTGIS="2.5.1 r17027" [EXTENSION] PGSQL="110" GEOS="3.7.0-CAPI-1.11.0
>> >3.7.1" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.2.4, released
>> >2018/03/19 GDAL_DATA not found" LIBXML="2.7.8" LIBJSON="0.12"
>> >LIBPROTOBUF="1.2.1" (core procs from "2.5.0 r16836" nee (...)"
>> >"PostgreSQL 11.2, compiled by Visual C++ build 1914, 64-bit"
>> >
>> >Running on windows 64-bit.
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200326/b025d7e6/attachment.html>
More information about the postgis-users
mailing list