Nome

ST_3DLongestLine — Retorna a linha 3-dimensional mais longa entre duas geometrias

Sinopse

geometry ST_3DLongestLine(geometry g1, geometry g2);

Descrição

Retorna a linha 3-dimensional mais longa entre duas geometrias. A função só retornará a primeira linha, se existirem mais de uma. A linha retornada sempre começará em g1 e acabará em g2. O comprimento da linha essa função sempre será o mesmo do ST_3DMaxDistance retorna para g1 e g2.

Disponibilidade: 2.0.0

Alterações: 2.2.0 - se 2 geometrias 2D são entradas, um ponto 2D retorna (em vez do antigo comportamento assumindo 0 para Z perdido). Em caso de 2D e 3D, o Z não é mais 0 para Z perdido.

This function supports 3d and will not drop the z-index.

This function supports Polyhedral surfaces.

Exemplos

Longest line between a LineString and a Point, comparing the 3D and 2D results.

Code
SELECT ST_3DLongestLine(line, pt) AS lol3d_line_pt, ST_LongestLine(line, pt) AS lol2d_line_pt
FROM (
    SELECT 'POINT(100 100 30)'::geometry AS pt,
           'LINESTRING (20 80 20,98 190 1,110 180 3,50 75 1000)'::geometry AS line
) AS foo;
Raster Outputs
lol3d_line_pt           |       lol2d_line_pt
-----------------------------------+----------------------------
 LINESTRING(50 75 1000,100 100 30) | LINESTRING(98 190,100 100)
Figure
Geometry figure for visual-st-3dlongestline-01

Longest line between a LineString and a MultiPoint, comparing the 3D and 2D results.

Code
SELECT ST_3DLongestLine(line, pt) AS lol3d_line_pt, ST_LongestLine(line, pt) AS lol2d_line_pt
FROM (
    SELECT 'MULTIPOINT(100 100 30,50 74 1000)'::geometry AS pt,
           'LINESTRING (20 80 20,98 190 1,110 180 3,50 75 900)'::geometry AS line
) AS foo;
Raster Outputs
lol3d_line_pt          |      lol2d_line_pt
---------------------------------+--------------------------
 LINESTRING(98 190 1,50 74 1000) | LINESTRING(98 190,50 74)
Figure
Geometry figure for visual-st-3dlongestline-02

Longest line between a Polygon and a MultiLineString, comparing the 3D and 2D results.

Code
SELECT ST_3DLongestLine(poly, mline) AS lol3d, ST_LongestLine(poly, mline) AS lol2d
FROM (
    SELECT ST_GeomFromEWKT(
               'POLYGON((175 150 5,20 40 5,35 45 5,50 60 5,100 100 5,175 150 5))'
           ) AS poly,
           ST_GeomFromEWKT(
               'MULTILINESTRING((175 155 2,20 40 20,50 60 -2,125 100 1,175 155 1),
               (1 10 2,5 20 1))'
           ) AS mline
) AS foo;
Raster Outputs
lol3d             |          lol2d
------------------------------+--------------------------
 LINESTRING(175 150 5,1 10 2) | LINESTRING(175 150,1 10)
Figure
Geometry figure for visual-st-3dlongestline-03