[PostGIS] #4794: ST_3DIntersection does not behave correctly with line strings when no vertex is seen within the intersecion

PostGIS trac at osgeo.org
Thu Aug 28 08:25:15 PDT 2025


#4794: ST_3DIntersection does not behave correctly with line strings when no
vertex is seen within the intersecion
------------------------+----------------------------
  Reporter:  basilrabi  |      Owner:  pramsey
      Type:  defect     |     Status:  new
  Priority:  medium     |  Milestone:  PostGIS 3.0.12
 Component:  postgis    |    Version:  3.0.x
Resolution:             |   Keywords:
------------------------+----------------------------
Changes (by robe):

 * milestone:  PostGIS SFCGAL => PostGIS 3.0.12


Old description:

> {{{
> -- POSTGIS="3.0.2 2fb2a18" [EXTENSION] PGSQL="130"
> GEOS="3.7.1-CAPI-1.11.1 27a5e771" SFCGAL="1.3.6" PROJ="Rel. 5.2.0,
> September 15th, 2018" GDAL="GDAL 2.4.0, released 2018/12/14"
> LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.3.1" WAGYU="0.4.3
> (Internal)" TOPOLOGY RASTER
>
> WITH solid AS (
>     SELECT ST_MakeSolid(
>         ST_Extrude(
>             ST_Translate(
>                 ST_Force3D(
>                     ST_GeomFromText('POLYGON ((-1 1,1 1,1 -1,-1 -1,-1
> 1))')
>                 ),
>                 0, 0, -1
>             ),
>             0, 0, 2
>         )
>     ) geom
> )
> SELECT
>     ST_AsText(ST_3DIntersection(
>         'LINESTRING (-2 0 0,2 0 2)'::geometry,
>         solid.geom
>     )),
>     ST_AsText(ST_3DIntersection(
>         'LINESTRING (-2 0 0,0 0 1,2 0 2)'::geometry,
>         solid.geom
>     ))
> FROM solid
> }}}
>
> The code above returns
>
> {{{
> POINT Z (-1 0 0.5), LINESTRING Z (-1 0 0.5,0 0 1)
> }}}
>
> But I think it should be both `LINESTRING Z (-1 0 0.5,0 0 1)`

New description:

 {{{
 -- POSTGIS="3.0.2 2fb2a18" [EXTENSION] PGSQL="130" GEOS="3.7.1-CAPI-1.11.1
 27a5e771" SFCGAL="1.3.6" PROJ="Rel. 5.2.0, September 15th, 2018"
 GDAL="GDAL 2.4.0, released 2018/12/14" LIBXML="2.9.4" LIBJSON="0.12.1"
 LIBPROTOBUF="1.3.1" WAGYU="0.4.3 (Internal)" TOPOLOGY RASTER

 WITH solid AS (
     SELECT ST_MakeSolid(
         ST_Extrude(
             ST_Translate(
                 ST_Force3D(
                     ST_GeomFromText('POLYGON ((-1 1,1 1,1 -1,-1 -1,-1
 1))')
                 ),
                 0, 0, -1
             ),
             0, 0, 2
         )
     ) geom
 )
 SELECT
     ST_AsText(ST_3DIntersection(
         'LINESTRING (-2 0 0,2 0 2)'::geometry,
         solid.geom
     )),
     ST_AsText(ST_3DIntersection(
         'LINESTRING (-2 0 0,0 0 1,2 0 2)'::geometry,
         solid.geom
     ))
 FROM solid
 }}}

 The code above returns

 {{{
 POINT Z (-1 0 0.5), LINESTRING Z (-1 0 0.5,0 0 1)
 }}}

 But I think it should be both `LINESTRING Z (-1 0 0.5,0 0 1)`

--
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4794#comment:1>
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