【发布时间】:2017-10-10 09:11:07
【问题描述】:
我对您对存储由 GPS 坐标(经度和纬度)和时间戳组成的 GPS 轨迹的最有效(或最智能)方式的意见感兴趣。
我正在考虑这两个想法:
gpsTrack = {
"gps_track" : {
"type": "FeatureCollection",
"features": [
{ "type": "Feature",
"geometry": {"type": "Point", "coordinates": [104.0, 0.3]},
"properties": {
"absolute_timestamp" : "2011-12-31T23:50:59Z"
}
},
{ "type": "Feature",
"geometry": {"type": "Point", "coordinates": [128.0, 0.5]},
"properties": {
"absolute_timestamp" : "2011-12-31T23:59:59Z"
}
}
] }
}
或者使用 GeoJSON MultiPoint 和时间戳作为一个数组。
gpsTrack = {
"geometry": {"type": "MultiPoint", "coordinates": [[104.0, 0.3], [128.0, 0.5]]},
"properties": {
"timestamps" : ["2011-12-31T23:50:59Z", "2011-12-31T23:59:59Z"]
}
路点总数假定为 4.000 到 10.000,但肯定低于 100.000。对于第一个想法,我担心集合会变得很长,因为每个点及其时间戳都是分开存储的。而第二个想法更紧凑并利用 MultiPoint GeoJSON 类型。
感谢您的意见。
【问题讨论】:
-
LineString 不是比
MultiPoint更适合跟踪数据吗? -
可能是,但是您不能在 MongoDB 中进行任何地理空间查询。但我更感兴趣的是如何将它与时间戳结合起来。
-
LineString 也被 mongodb 地理查询支持。除了 lineString 或 MultiPoint,用于时间戳部分;如果将时间戳作为第三个元素放在坐标子数组中会怎样?我没有尝试过,但很可能 mongodb 会在地理查询中忽略它,但您可以使用它,并且不需要匹配坐标数组和时间戳数组
-
我没有得到时间戳部分。您可以使用示例 MongoDB 结构发布答案吗?