使用MongoDB的三维数据Geospacial指数 [英] Using MongoDB's Geospacial index with 3d data

查看:529
本文介绍了使用MongoDB的三维数据Geospacial指数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组的每一个包含存储在MongoDB的集合中3-空间中的点的文档。 MongoDB中目前拥有的地理空间指标只有2空间。是否有借力Geospacial指数做类似的疑问在3维空间数据的方式?

I have a set of documents each of which contain a point in 3-space stored in a MongoDB collection. MongoDB currently has Geospatial Indexes only for 2-space. Is there a way of leveraging the Geospacial Index to do similar queries on 3-space data?

推荐答案

您可以杂牌它通过COM pressing的尺寸之一,但你会失去一半的precision。

You could kludge it by compressing one of the dimensions, but you would lose half your precision.

说,如果他们是64位的密钥,你想保存3个32位坐标: [(X<< 32)+ Y,Z]

Say if they were 64 bit keys and you wanted to store three 32 bit coordinates: [(x << 32) + y, z]

哎呀,你甚至可以交错三年其存储在一个关键的:

Heck, you can even interleave three and store it in one key:

XXX

YYY

ZZZ

xyzxyzyz

这篇关于使用MongoDB的三维数据Geospacial指数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆