[postgis-tickets] [PostGIS] #5288: ST_LineCrossingDirection defect on LINE MULTICROSS END SAME FIRST LEFT ?

PostGIS trac at osgeo.org
Sat Nov 12 15:32:45 PST 2022


#5288: ST_LineCrossingDirection defect on LINE MULTICROSS END SAME FIRST LEFT ?
-------------------------+---------------------
 Reporter:  arthurbazin  |      Owner:  pramsey
     Type:  defect       |     Status:  new
 Priority:  medium       |  Milestone:
Component:  postgis      |    Version:  3.2.x
 Keywords:               |
-------------------------+---------------------
 With the ST_LineCrossingDirection, I have unexpected results.

 Using this request, I can simulate some crossing but the result is
 unexpected for
 the line 2 and 3 :

 {{{
 SELECT
   line_number,
   ST_LineCrossingDirection(geom_a, geom_b) "a_/_b",
   ST_LineCrossingDirection(geom_b, geom_a) "b_/_a",
   geom_a,
   geom_b
 FROM (
   VALUES
     (
       'LINESTRING (1 0, 1 1, 2 2, 2 3)'::geometry,
       'LINESTRING (2 0, 2 1, 1 2, 1 3)'::geometry,
       1
     ),
     (
       'LINESTRING (1 0, 1 1, 2 2, 1 3, 1 4)'::geometry,
       'LINESTRING (2 0, 2 1, 1 2, 2 3, 2 4)'::geometry,
       2
     ),
     (
       'LINESTRING (1 0, 1 1, 2 2, 1 3, 2 4, 2 5)'::geometry,
       'LINESTRING (2 0, 2 1, 1 2, 2 3, 1 4, 1 5)'::geometry,
       3
     ),
     (
       'LINESTRING (1 0, 1 1, 2 2, 1 3, 2 4, 1 5, 1 6)'::geometry,
       'LINESTRING (2 0, 2 1, 1 2, 2 3, 1 4, 2 5, 2 6)'::geometry,
       4
     )
 ) AS t1 ("geom_a", "geom_b", line_number)
 ;
 }}}

 Result :
 {{{
  line_number | a_/_b | b_/_a | geom_a
 | geom_b                                         |
 -------------+-------+-------+------------------------------------------------+------------------------------------------------+
            1 |    -1 |     1 | LINESTRING (1 0, 1 1, 2 2, 2 3)
 | LINESTRING (2 0, 2 1, 1 2, 1 3)                |
            2 |    -3 |    -3 | LINESTRING (1 0, 1 1, 2 2, 1 3, 1 4)
 | LINESTRING (2 0, 2 1, 1 2, 2 3, 2 4)           |
            3 |    -2 |     2 | LINESTRING (1 0, 1 1, 2 2, 1 3, 2 4, 2 5)
 | LINESTRING (2 0, 2 1, 1 2, 2 3, 1 4, 1 5)      |
            4 |    -3 |    -3 | LINESTRING (1 0, 1 1, 2 2, 1 3, 2 4, 1 5, 1
 6) | LINESTRING (2 0, 2 1, 1 2, 2 3, 1 4, 2 5, 2 6) |
 }}}

 Will the column "b_/_a" be "3" instead of "-3" ?
 The A line comes from the left of B and the B line comes from the right of
 A

 Maybe I don't understand correctly this function but I can not explain how
 it works with this result.

 My version of PostGIS :
 POSTGIS="3.2.1 3.2.1" [EXTENSION] PGSQL="130" GEOS="3.10.2-CAPI-1.16.0"
 PROJ="7.2.1" GDAL="GDAL 3.4.2, released 2022/03/08 GDAL_DATA not found"
 LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)"
 RASTER
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5288>
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