[PostGIS] #6007: Different results with two version of postgis master.

PostGIS trac at osgeo.org
Thu Oct 23 13:23:46 PDT 2025


#6007: Different results with two version of postgis master.
--------------------------------+---------------------------
  Reporter:  Lars Aksel Opsahl  |      Owner:  pramsey
      Type:  defect             |     Status:  new
  Priority:  medium             |  Milestone:  PostGIS 3.6.1
 Component:  postgis            |    Version:  master
Resolution:                     |   Keywords:
--------------------------------+---------------------------
Comment (by strk):

 The difference between those two revision is the 0-tolerance:
 {{{
 git diff  fda22140e..d1c28c62c liblwgeom/topo/
 diff --git a/liblwgeom/topo/lwgeom_topo.c b/liblwgeom/topo/lwgeom_topo.c
 index c0d6d5356..3e7cfdc1e 100644
 --- a/liblwgeom/topo/lwgeom_topo.c
 +++ b/liblwgeom/topo/lwgeom_topo.c
 @@ -6764,7 +6764,7 @@ _lwt_AddPoint(LWT_TOPOLOGY* topo, LWPOINT* point,
 double tol, int
    LWT_ELEMID id = 0;

    /* Get tolerance, if 0 was given */
 -  if (!tol)
 +  if ( tol == -1 )
      tol = _LWT_MINTOLERANCE(topo, pt);

    LWDEBUGG(1, pt, "Adding point");
 @@ -7168,7 +7168,7 @@ _lwt_AddLine(LWT_TOPOLOGY* topo, LWLINE* line,
 double tol, int* nedges,
    *nedges = -1; /* error condition, by default */

    /* Get tolerance, if 0 was given */
 -  if ( ! tol ) tol = _LWT_MINTOLERANCE( topo, (LWGEOM*)line );
 +  if ( tol == -1 ) tol = _LWT_MINTOLERANCE( topo, (LWGEOM*)line );
    LWDEBUGF(1, "Working tolerance:%.15g", tol);
    LWDEBUGF(1, "Input line has srid=%d", line->srid);

 @@ -7605,7 +7605,7 @@ lwt_AddPolygon(LWT_TOPOLOGY* topo, LWPOLY* poly,
 double tol, int* nfaces)
    }

    /* Get tolerance, if 0 was given */
 -  if ( ! tol ) tol = _LWT_MINTOLERANCE( topo, (LWGEOM*)poly );
 +  if ( tol == -1 ) tol = _LWT_MINTOLERANCE( topo, (LWGEOM*)poly );
    LWDEBUGF(1, "Working tolerance:%.15g", tol);

    lwt_LoadPolygon(topo, poly, tol);
 }}}

 See if you get the expected behaviour by passing -1 instead of 0 to your
 TopoGeo_LoadGeometry or TopoGeo_Add* calls.
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/6007#comment:9>
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