Changes between Initial Version and Version 3 of Ticket #5589


Ignore:
Timestamp:
Nov 2, 2023, 10:54:57 PM (7 months ago)
Author:
Wenjing
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5589

    • Property Cc Wenjing added
  • Ticket #5589 – Description

    initial v3  
    1 For the following query involving ST_3DDistance:
    2 
     1Consider the following statement
    32{{{
    43SELECT ST_3DDistance(b1, b2) 
     
    109-- (1 row)
    1110}}}
     11The ST_3DDistance function is expected to give the result but it doesn't.
    1212
    13 PostGIS returns a null result which is unexpected.
    14 
    15 PostGIS seems not to work for LINESTRINGs (i.e., returning an unexpected null result) when
    16 (1) both LINESTRINGs start from 0,0,0 and
    17 (2) both LINESTRINGs only involve two points.
    18 
    19 (1) For example, when a LINESTRING does not start from 0,0,0
     13The version:
    2014
    2115{{{
    22 SELECT ST_3DDistance(b1, b2) 
    23 FROM ST_GeomFromText('LINESTRING Z (0 0 1, 0 0 0)') As b1,
    24 ST_GeomFromText('LINESTRING Z (0 0 0, 0 0 1)') As b2;
    25 --  st_3ddistance
    26 ---------------
    27 --              0
    28 -- (1 row)
     16 POSTGIS="3.5.0dev 3.4.0rc1-705-g5c3ec8392" [EXTENSION] PGSQL="170" GEOS="3.13.0dev-CAPI-1.18.0" PROJ="8.2.1 NETWORK_ENABLED=OFF URL_ENDPOINT=https://c
     17dn.proj.org USER_WRITABLE_DIRECTORY=/tmp/proj DATABASE_PATH=/usr/share/proj/proj.db" LIBXML="2.9.13"
     18(1 row)
    2919}}}
    3020
    31 PostGIS can give the expected result.
    3221
    33 (2) or when a LINESTRING involves more than two points
    34 
    35 
    36 {{{
    37 SELECT ST_3DDistance(b1, b2) 
    38 FROM ST_GeomFromText('LINESTRING Z (0 0 0, 0 1 0, 0 2 0)') As b1,
    39 ST_GeomFromText('LINESTRING Z (0 0 0, 1 0 0)') As b2;
    40 --  st_3ddistance
    41 ---------------
    42 --              1
    43 -- (1 row)
    44 }}}
    45 
    46 PostGIS also works for the case.
    47 
    48 The unexpected behavior for ST_3DDistance also propagates to ST_3DDWithin.
    49 
    50 For example, the following query is expected to have true while PostGIS gives false
    51 
    52 
    53 {{{
    54 SELECT ST_3DDWithin(b1, b2, 10000) 
    55 FROM ST_GeomFromText('LINESTRING Z (0 0 0, 1 0 0)') As b1,
    56 ST_GeomFromText('LINESTRING Z (0 0 0, 1 1 1)') As b2;
    57 --expected{t},actual{f}
    58 }}}
    59 The ST_3DDWithin works correctly if we change the start point or add one more point as above.
    60 
    61 {{{
    62 SELECT ST_3DDWithin(b1, b2, 10000) 
    63 FROM ST_GeomFromText('LINESTRING Z (0 0 1, 1 0 0)') As b1,
    64 ST_GeomFromText('LINESTRING Z (0 0 0, 1 1 1)') As b2;
    65 --result{t}
    66 }}}
    67 
    68 {{{
    69 SELECT ST_3DDWithin(b1, b2, 10000)
    70 FROM ST_GeomFromText('LINESTRING Z (0 0 0, 1 0 0, 1 2 1)') As b1,
    71 ST_GeomFromText('LINESTRING Z (0 0 0, 1 1 1)') As b2;
    72 --result{t}
    73 }}}
    74 
    75 version:
    76 POSTGIS="3.5.0dev 3.4.0rc1-705-g5c3ec8392"
    77 [EXTENSION]
    78 PGSQL="170"
    79 GEOS="3.13.0dev-CAPI-1.18.0"
    80 PROJ="8.2.1 NETWORK_ENABLED=OFF
    81 URL_ENDPOINT=https://cdn.proj.org
    82 USER_WRITABLE_DIRECTORY=/tmp/proj
    83 DATABASE_PATH=/usr/share/proj/proj.db"
    84 LIBXML="2.9.13" PostgreSQL 17devel on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-
    85 1ubuntu1~22.04) 11.4.0, 64-bit