ST_ClosestPoints - Spectrum_Location_Intelligence_for_Big_Data - 5.2.1

Location Intelligence SDK for Big Data Guide

Product type
Software
Portfolio
Locate
Product family
Spectrum
Product
Spatial Big Data > Location Intelligence SDK for Big Data
Version
5.2.1
Language
English
Product name
Location Intelligence for Big Data
Title
Location Intelligence SDK for Big Data Guide
Copyright
2024
First publish date
2015
Last updated
2024-10-16
Published on
2024-10-16T13:55:01.634374

Description

The ST_ClosestPoints function returns the closest points between two geometries.

Syntax

ST_ClosestPoints(WritableGeometry geometry1, WritableGeometry geometry2)

Parameters

Parameter Type Description
geometry1 WritableGeometry The first instance of a WritableGeometry.
geometry2 WritableGeometry The second instance of a WritableGeometry.

Return Values

Return Type Description
Array<WritableGeometry> The closest points between the two geometries. The geometries that intersect are at distance zero from each other, and in this case a shared point is returned.

Examples

SELECT ST_ToWKT(result.points[0]) AS point1, ST_ToWKT(result.points[1]) AS point2 FROM table t 
LATERAL VIEW OUTER inline(array(named_struct('points', ST_ClosestPoints(ST_GeomFromWKT(t.geometry1, 'epsg:4326'), 
ST_GeomFromWkt(t.geometry2, 'epsg:4326'), 'SPHERICAL')))) result;