计算轨迹每个中间点的转动半径,返回一个浮点数组。
语法
double precision[] ST_CurvatureRadius(trajectory traj, boolean hasdirection default false);
参数
参数名称 | 描述 |
traj | 轨迹对象。 |
hasdirection | 是否计算轨迹的转向方向。 如果为true,则向逆时针方向转向时,返回负值。 |
描述
对轨迹的每个中间点(假设某个轨迹有n个点,则其有n-2个中间点),计算轨迹在此点的转动半径。如果在此点沿直线运动,或停留在原地,则转动半径为无穷。转动半径越小说明转弯越急。
示例
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}
文档内容是否对您有帮助?