私は、運動学的データのテーブル(船舶からの位置報告)を持っています。表は、以下の行を有する:AISデータセットに基づいて各船の軌道を計算する
row name: type: Description:
timestamp double precision timestamp in UNIX epochs (seconds from 1/1/1970)
type integer AIS message type
mmsi integer MMSI identifier for vessel
status integer Navigational status
lon double precision Longitude (georeference: WGS 1984)
lat double precision Latitude (georeference: WGS 1984)
heading integer True heading in degrees (0-359), relative to true north
turn double precision Rate of turn, right or left, 0 to 720 degrees per minute
speed double precision Speed over ground in knots (allowed values: 0-102.2 knots)
course double precision Course over ground (allowed values: 0-359.9 degrees).
Iは、データをインポートした後、私は1つの以上の経度を用いて形成されたタイプの幾何学的形状の行、緯度と、タイムスタンプ列を追加した:
SELECT AddGeometryColumn ('public', 'gis_may', 'geom_time', 4326, 'POINTZ', 3);
UPDATE public.gis_may SET geom_time = ST_Transform(ST_SetSRID(ST_MakePoint(lon, lat, gis_may.timestamp), 4326),4326);
Iを計算しなければなりませんこのデータに基づいて各船の軌道を計算します。私は以下のコード使用してみました:
CREATE TABLE ship_trajectories AS SELECT st_makeline(st_setsrid(st_makepoint(lon::REAL, lat::REAL, gis_may.timestamp), 4326)) as traj
FROM gis_may
GROUP BY mmsi;
を...しかし、問題は、このコードはのみ、各船の座標に基づいてのみ、1ラインストリング/軌道を返し、考慮に船が動いて停止時間を取ることはありません、です。
この解決方法は次の行を使用していると思います。status
(私は検索して、どのようなナビゲートステータスが:https://help.marinetraffic.com/hc/en-us/articles/203990998-What-is-the-significance-of-the-AIS-Navigational-Status-Values-)を使用しています。 status
が0の場合は船が移動していることを意味し、1の場合は軌道を形成しないように固定されていることを意味します。