計算軌跡每個中間點的轉動半徑,返回一個浮點數組。
文法
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}