[postgis-tickets] [PostGIS] #5565: ST_Snap doesn't maintain the input type

PostGIS trac at osgeo.org
Thu Oct 5 03:59:55 PDT 2023


#5565: ST_Snap doesn't maintain the input type
---------------------+---------------------------
 Reporter:  lkajan   |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:  PostGIS 3.4.1
Component:  postgis  |    Version:  3.4.x
 Keywords:           |
---------------------+---------------------------
 I have encountered unexpected behavior when using the ST_Snap() function.
 According to my expectation, when passing a geometry to ST_Snap(), the
 result should be of the same type as the input. However, I've noticed that
 z-values are sometimes dropped, and multi-geometries are reduced to single
 geometries.

 SELECT ST_AsText(ST_Snap('pointz(0.01 0 0)', 'point(0 0)', 0.1))\\
 --POINT(0 0)

 SELECT ST_AsText(ST_Snap('pointz(0.01 0 0)', 'pointz(0 0 nan)', 0.1))\\
 --POINT(0 0)

 SELECT ST_AsText(ST_Snap('multipoint((0.01 0))', 'point(0 0)', 0.1))\\
 --POINT(0 0)

 This behavior makes using results of ST_Snap less straightforward. For
 example, the following queries may not work as expected without ST_Multi
 and ST_Force3D functions:\\
 UPDATE table1 SET geom = ST_Snap(geom, collection, 0.01) FROM ...;\\
 SELECT ST_Collect(ST_Snap(geom, collection), 0.01) FROM ...; (ST_Collect
 excepts uniform dimensions)

 Versions:

 - PostgreSQL 16.0 (Debian 16.0-1.pgdg110+1) on x86_64-pc-linux-gnu,
 compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
 - POSTGIS="3.4.0 0874ea3" [EXTENSION] PGSQL="160" GEOS="3.9.0-CAPI-1.16.2"
 PROJ="7.2.1 NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org
 USER_WRITABLE_DIRECTORY=/var/lib/postgresql/.local/share/proj
 DATABASE_PATH=/usr/share/proj/proj.db" LIBXML="2.9.10" LIBJSON="0.15"
 LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5565>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list