从列式数据库中取出坐标数据,格式化成地图轨迹需要的数据
最后更新:2023-10-18 20:59:44
|
状态:未完成
轨迹原始数据(保存在列式数据库或thingsboard平台上) lng=[{"ts":1655007789001,"value":120.1}, {"ts":1655007759002,"value":120.2}], lat=[{"ts":1655007789001,"value":36.1}, {"ts":1655007759002,"value":36.2}] 通过org.anyline.thingsboard.util.ThingsBoardClient.getTimeseries()取出列的DataSet结构: [{"TS":1657707789001, "LNG":120.1, "LAT":36.1}, {"TS":1657707759002, "LNG":120.2, "LAT":36.2}] DataSet转换成地图轨迹常用的格式: { //点位时间 time: [1657707789001, 1657707759002], //点位坐标 path: [ [120.1, 36.1], [120.2, 36.2], ] } 取出时间 List<Long> times = set.getLongs("TS"); 取出坐标 List<Double[]> points = set.getDoubleArrays("LNG", "LAT");