Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2183 closed defect (fixed)

ST_SimplifyPreserveTopology does not preserve the topology

Reported by: pcav Owned by: strk
Priority: medium Milestone: PostGIS GEOS
Component: postgis Version: 2.0.x
Keywords: Cc:

Description

SELECT ST_ChangeEdgeGeom('province_topo', edge_id, ST_SimplifyPreserveTopology(geom, 500)) topo2→ FROM province_topo.edge; ERROR: Invalid edge (no two distinct vertices exist)

whereas:

SELECT ST_ChangeEdgeGeom(

'province_topo', edge_id,

ST_SimplifyPreserveTopology(geom, 500))

FROM province_topo.edge WHERE ST_IsValid( ST_SimplifyPreserveTopology(geom, 500));

completes the task, but drops all islands. See attached shapefile.

Attachments (1)

topogeom.tar.gz (447.3 KB ) - added by pcav 12 years ago.

Download all attachments as: .zip

Change History (12)

by pcav, 12 years ago

Attachment: topogeom.tar.gz added

comment:1 by strk, 12 years ago

Could you please only send the smallest geometry giving the problem ?

SELECT geom FROM province_topo.edge WHERE NOT ST_IsValid(ST_SimplifyPreserveTopology(geom,500))
ORDER BY ST_NPoints(geom) LIMIT 1

comment:2 by strk, 12 years ago

Component: topologypostgis
Status: newassigned

comment:3 by pcav, 12 years ago

0102000020BB0B00000C00000059FFFFCAC03F39412A008004CBFC51415BFFFF61B53F39412B00809DCBFC51415BFFFF40AE3F39412B00005DCEFC51415AFFFF4FB43F39412B0080DFD0FC514159FF7F29A13F39412A000028DBFC51415AFF7F88A23F39412B008014E0FC51415BFFFF21AC3F39412B0000EFE0FC514159FFFFF3C53F39412A008018D6FC51415AFFFF80DA3F39412A0080ECD2FC51415BFFFFA1DF3F39412B000022CEFC51415AFFFFF3D33F39412A0080DFCCFC514159FFFFCAC03F39412A008004CBFC5141

comment:4 by strk, 12 years ago

I can't confirm that geometry triggers an error inST_SimplifyPreserveTopology:

with inp as ( select '0102000020BB0B00000C00000059FFFFCAC03F39412A008004CBFC51415BFFFF61B53F39412B00809DCBFC51415BFFFF40AE3F39412B00005DCEFC51415AFFFF4FB43F39412B0080DFD0FC514159FF7F29A13F39412A000028DBFC51415AFF7F88A23F39412B008014E0FC51415BFFFF21AC3F39412B0000EFE0FC514159FFFFF3C53F39412A008018D6FC51415AFFFF80DA3F39412A0080ECD2FC51415BFFFFA1DF3F39412B000022CEFC51415AFFFFF3D33F39412A0080DFCCFC514159FFFFCAC03F39412A008004CBFC5141'::geometry as g ) select st_isvalid(st_simplifypreservetopology(g, 500)) from inp;

Does the above query return false for you ? I thought in IRC you said a similar query was returning false (ie: non-valid returns from ST_SimplifyPreserveTopology)

comment:5 by pcav, 12 years ago

NOTICE:  Too few points in geometry component at or near point 1654720.7929687111 4715308.0703125391
 st_isvalid 
------------
 f
(1 row)

comment:6 by strk, 12 years ago

SELECT version();
SELECT postgis_full_version();

Here:

 PostgreSQL 9.1.7 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit
 POSTGIS="2.0.3SVN r10972" GEOS="3.4.0dev-CAPI-1.8.0 r3749" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.2, released 2012/10/08" LIBXML="2.7.8" LIBJSON="UNKNOWN" TOPOLOGY (topology procs from "2.0.3SVN r10980" need upgrade) RASTER (raster procs from "2.0.2SVN r10758" need upgrade)

comment:7 by pcav, 12 years ago

 PostgreSQL 9.1.7 on x86_64-unknown-linux-gnu, compiled by gcc-4.7.real (Debian 4.7.2-4) 4.7.2, 64-bit
 POSTGIS="2.0.2 r10789" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.7.1, 23 September 2009" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.8.0" TOPOLOGY RASTER

comment:8 by strk, 12 years ago

can you try upgrading GEOS to 3.3.6 ?

comment:9 by pcav, 12 years ago

unfortunately not, sorry

comment:10 by strk, 12 years ago

Resolution: fixed
Status: assignedclosed

I guess this was fixed in GEOS, after 3.3.3 — Feel free to reopen if it still fails with 3.3.6 installed.

comment:11 by strk, 12 years ago

Milestone: PostGIS 2.0.4PostGIS GEOS
Note: See TracTickets for help on using tickets.