All Products
Search
Document Center

ApsaraDB RDS:ST_CurvatureRadius

Last Updated:Jan 17, 2024

This topic describes the ST_CurvatureRadius function. This function calculates the rotation radius of a trajectory at each intermediate point and returns an array of floating-point numbers.

Syntax

double precision[] ST_CurvatureRadius(trajectory traj, boolean hasdirection default false);

Parameters

Parameter

Description

traj

The trajectory object.

hasdirection

Specifies whether to calculate the direction of rotation of the trajectory.

If the direction of rotation of a trajectory is calculated, a negative value is returned when the trajectory is rotated in the counterclockwise direction.

Description

This function calculates the rotation radius of a trajectory at each intermediate point. If a trajectory has n points, the number of intermediate points of the trajectory is the difference between n and 2. If the trajectory moves along a straight line or stays unchanged at an intermediate point, the rotation radius of the trajectory is infinite. The smaller the rotation radius of the trajectory, the sharper the curve is.

Examples

SELECT ST_CurvatureRadius(ST_MakeTrajectory('STPOINT'::leaftype,'LINESTRING(0 0, 0 8, 6 8, 12 8, 12 8)', '2000-01-01', '2000-01-01'::timestamp+ '1 day'::interval* (ST_NPoints('LINESTRING(0 0, 0 8, 6 8, 12 8, 12 8)')-1), '{}'));
  st_curvatureradius   
-----------------------
 {5,Infinity,Infinity}


SELECT ST_CurvatureRadius(ST_MakeTrajectory('STPOINT'::leaftype,'LINESTRING(0 0, 0 8, 6 8, 12 8, 12 8, 6 8, 0 8, 0 0)', '2000-01-01', '2000-01-01'::timestamp+ '1 day'::interval* (ST_NPoints('LINESTRING(0 0, 0 8, 6 8, 12 8, 12 8, 6 8, 0 8, 0 0)')-1), '{}'));
st_curvatureradius 
-----------
 {5,Infinity,Infinity,Infinity,Infinity,5}


SELECT ST_CurvatureRadius(ST_MakeTrajectory('STPOINT'::leaftype,'LINESTRING(0 0, 0 8, 6 8, 12 8, 12 8, 6 8, 0 8, 0 0)', '2000-01-01', '2000-01-01'::timestamp+ '1 day'::interval* (ST_NPoints('LINESTRING(0 0, 0 8, 6 8, 12 8, 12 8, 6 8, 0 8, 0 0)')-1), '{}'), true);
 st_curvatureradius 
-----------
 {5,Infinity,Infinity,Infinity,Infinity,-5}


SELECT ST_CurvatureRadius(ST_MakeTrajectory('STPOINT'::leaftype,'LINESTRING(0 0, 0 8, 6 8, 12 8, 12 8, 6 8, 0 8, 0 0, 0 4, 3 4)', '2000-01-01', '2000-01-01'::timestamp+ '1 day'::interval* (ST_NPoints('LINESTRING(0 0, 0 8, 6 8, 12 8, 12 8, 6 8, 0 8, 0 0, 0 4, 3 4)')-1), '{}'), true);
st_curvatureradius
-----------
 {5,Infinity,Infinity,Infinity,Infinity,-5,0,2.5}