如何在 Cassandra 中表示空间数据

发布于 2024-10-16 08:46:46 字数 49 浏览 9 评论 0原文

有人可以告诉我如何在 Cassandra 中表示空间数据(来自 postgis)吗?

Can someone tell me how to represent spatial data (coming from postgis) in Cassandra?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

少女的英雄梦 2024-10-23 08:46:46

这个演示非常有趣,关于 Cassandra 中的空间数据主题,可能会有所帮助:

http://www.readwriteweb.com/cloud/2011/02/video-simplegeo-cassandra.php

This presentation was pretty interesting, on the topic of spatial data in Cassandra, and may help:

http://www.readwriteweb.com/cloud/2011/02/video-simplegeo-cassandra.php

嗼ふ静 2024-10-23 08:46:46

请提供更多有关您想要实现的目标的详细信息。

这对于 Cassandra(相对于关系数据库)来说尤其重要,因为您需要对数据进行建模以支持所需的特定查询,而不是以相当通用的方式对域进行建模,然后使用 SQL 来定义查询。

您是否只是想查找具有唯一标识符的实体的纬度/经度,或者您是否有与您的实体相关的更复杂的形状 - 或者什么?

Please provide a bit more detail on what you are trying to achieve.

This is particularly important for Cassandra (as opposed to a relational database), because you need to model the data to support the specific queries you need, rather than modelling the domain in a fairly generic way and using SQL to define queries afterwards.

Are you just trying to look up lat/longs for entities with unique identifiers, or do you have more complex shapes associated with your entities - or what?

海未深 2024-10-23 08:46:46

回应 Roland 先生(希望是 OP):

您需要提出自己的索引方案,并将索引存储在 Cassandra 中。

例如,您可以将空间细分为正方形(可能使用分层结构,例如四叉树)并将每个正方形存储在 Cassandra 行中,列存储落在正方形内的对象。您的客户端代码需要确定每个纬度和经度的正确正方形,然后查找该正方形(或多个正方形)中覆盖您想要的半径的对象,然后执行最终的客户端过滤器以删除恰好是的任何对象由于它们存储在正方形中,因此位于半径之外。

Responding to Mr. Roland (and hopefully the OP):

You'd need to come up with your own indexing scheme, and store the indexes in Cassandra.

For example, you could subdivide the space into squares (perhaps using a hierarchical structure such as a quadtree) and store each square in a Cassandra row, with the columns storing the objects that fall within the square. Your client code would need to determine the correct square for each lat,long, then look up the objects in that square (or squares) that cover the radius you desire, then do a final client-side filter to remove any objects that are just outside the radius due to them being stored in squares.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文