【发布时间】:2018-04-05 15:42:29
【问题描述】:
如official documentation中所见,多边形GeoJSON对象的结构如下图所示:
db.someCollection.insert({
type: "Polygon",
coordinates: [[[0, 0], [3, 6], [6, 1], [0, 0]]]
});
为什么不像下图那么简单:
A型
db.someCollection.insert({
type: "Polygon",
coordinates: [[0, 0], [3, 6], [6, 1], [0, 0]]
});
我认为原因可能是存储多个地理围栏。像这样的:
B型
db.someCollection.insert({
type: "Polygon",
coordinates: [
[[0, 0], [3, 6], [6, 1], [0, 0]],
[[1, 1], [3, 6], [6, 1], [1, 1]]
]
});
我发布这个问题的原因是因为我猜我的假设在使用 Mongo DB 中的某些功能(如 $geoIntersects 和 $geoWithin)后是错误的,这需要结构在 Type A 格式。
【问题讨论】:
标签: mongodb mongodb-query geospatial datamodel