Protocol Buffers (Protobuf) のバイナリデータを trajectory オブジェクトに変換します。
構文
trajectory ST_TrajFromProtobuf(bytea protobuf)
パラメーター
| パラメーター | 説明 |
|---|---|
protobuf |
Protobuf でエンコードされたトラジェクトリデータを含む bytea 値です。想定されるスキーマについては、 を参照してください。 |
戻り値
trajectory オブジェクトを返します。入力を解析できない場合は NULL を返します。
例
次のクエリでは、トラジェクトリを Protobuf のエンコーディングとデコーディングでラウンドトリップします。st_makeTrajectory はトラジェクトリを構築し、ST_AsProtobuf はそれを bytea にシリアル化し、ST_TrajFromProtobuf はそれを trajectory オブジェクトにデシリアル化します。
SELECT ST_TrajFromProtobuf(ST_AsProtobuf(st_makeTrajectory('STPOINT'::leaftype, ARRAY[1::float8], ARRAY[2::float8], 4326, ARRAY['2010-01-01 11:30'::timestamp], ARRAY['velocity'], ARRAY[1::int4], NULL, NULL, NULL::anyarray)));
出力:
st_trajfromprotobuf
---------------------------
{"trajectory":{"version":1,"type":"STPOINT","leafcount":1,"start_time":"2010-01-01 11:30:00","end_time":"2010-01-01 ...