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 |