[postgis-users] st_intersection of 3D objects

Mike Taves mwtoews at gmail.com
Thu Apr 27 20:54:20 PDT 2023


On Fri, 28 Apr 2023 at 08:54, Regina Obe <lr at pcorp.us> wrote:
> When you say – it used to return ‘POINT Z(0 0 2.5)’  which version of GEOS and PostGIS were you running?

I also see this with an older version:
POSTGIS="2.4.0 r15853" PGSQL="96" GEOS="3.5.0-CAPI-1.9.0 r4084"
PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.4, released
2016/01/25" LIBXML="2.9.1" LIBJSON="0.11" RASTER

But the expected answer really is not certain, since they don't intersect in 3D.

Another answer, using linear interpolation via ST_LineInterpolatePoint:

db=> SELECT ST_LineLocatePoint(A, B),
ST_AsText(ST_LineInterpolatePoint(A, ST_LineLocatePoint(A, B)))
db-> FROM (
db(>   SELECT 'LINESTRINGZ ( 0 0 5, 0 2 5)'::geometry A, 'POINTZ(0 0
0)'::geometry B
db(> ) d;
-[ RECORD 1 ]------+----------------
st_linelocatepoint | 0
st_astext          | POINT Z (0 0 5)

So the expected Z value is either 0 for the input point, 5 for the
input line, or 2.5 for "mid-way".


More information about the postgis-users mailing list