第十六节 车联网的车辆历史轨迹存储到TDengine时序数据库

亮子 | 2026-02-27 16:17:32 | 31 | 0 | 0 | 0

1、建表

1)、创建超级表

CREATE STABLE IF NOT EXISTS  vihicle_location (
    ts timestamp, 
    lon double, 
    lat double, 
    speed float,
    direction int,
    altitude float
) TAGS (
    vin varchar(64), 
    plate_number varchar(64)
);
  • ts 时间戳
  • lon 经度
  • lat 纬度
  • speed 速度
  • direction 方向
  • altitude 海拔

标签
- vin 车辆唯一编号
- plate_number 车牌号

2)、创建子表

CREATE TABLE IF NOT EXISTS lv123456 
USING vihicle_location (
    vin,
    plate_number
) TAGS (
    "lv123456", 
    "津HJN609"
);

image.png