[PostGIS] #6089: wrong node used when adding a new long line

PostGIS trac at osgeo.org
Tue Jun 30 22:45:44 PDT 2026


#6089: wrong node used when adding a new long line
--------------------------------+--------------------
  Reporter:  Lars Aksel Opsahl  |      Owner:  strk
      Type:  defect             |     Status:  new
  Priority:  medium             |  Milestone:
 Component:  topology           |    Version:  master
Resolution:                     |   Keywords:  snap
--------------------------------+--------------------
Changes (by strk):

 * keywords:   => snap

Comment:

 I could reproduce with just using ST_Snap. This is a simplified testcase:
 {{{
 CREATE SCHEMA t6089;
 CREATE TABLE t6089.edge ( id int primary key, geom geometry );
 INSERT INTO t6089.edge VALUES
   ( 5,
 '0102000020A210000002000000154AE61BA01A2840A2F897DE1D715040E822874E991A284032362A1D1D715040'
 ),
   ( 4,
 '0102000020A21000000200000014F1AC1FA01A28406C5803DF1D715040154AE61BA01A2840A2F897DE1D715040'
 )
 ;

 -- Offending input
 CREATE TABLE t6089.incoming AS SELECT
   1::int as id,
 '0102000020A210000002000000C01856A5171528406C5803DF1D71504064BFAEFB153728406C5803DF1D715040'::geometry
 g;

 -- Input snapped to edges
 create table t6089.incoming_snapped as select i.id, ST_Snap(i.g,
 st_collect(e.geom), 1e-07)  from t6089.incoming i, t6089.edge e group by
 i.id, i.g;
 }}}

 And this is what happens:
 [[Image(snapping.png)]]

 The lenght of the upper edge (completely covered by the snapped incoming
 line) is computed by PostGIS to be ~1.5e-07 (so bigger than tolerance):
 {{{
 strk=# select id, ST_length(geom) from t6089.edge;
  id |       st_length
 ----+------------------------
   5 |  6.942671476753422e-05
   4 | 1.5054470047841826e-07
 (2 rows)
 }}}
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/6089#comment:5>
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