哪种 FOSS RDBMS 用于地理空间数据?

发布于 2024-12-11 13:29:00 字数 219 浏览 0 评论 0原文

我正在使用 Google Maps API 开发一个应用程序。目标是对某些位置进行地理编码,然后允许用户根据距离用户最近的位置来搜索这些位置(例如“物体 x 距离您 20 英里”)。

在MySQL中,我可以只存储地理坐标并使用半正弦公式来进行距离计算。有人建议我考虑 Postgres,因为它“对地理数据有更好的支持”。

那么,问题是:使用 MySQL 或 Postgres 的优缺点是什么?

I'm developing an application using Google Maps API. The goal is to geocode certain locations and then allow users to search for these locations based on which ones are nearest to the user (e.g. "Thing x is 20 miles from you").

In MySQL, I can just store the geo-coordinates and use haversine formula to do the distance calculations. Someone has suggested I consider Postgres because it has "better support for geographical data."

So, the question is: what are the pros and cons of using MySQL or Postgres?

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

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

发布评论

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

评论(3

月寒剑心 2024-12-18 13:29:00

PostgreSQL 支持您在船上谈论的内容。但如果需要更多功能(以及您提到的“某人”可能正在考虑的内容),请转向 PostGIS

请参阅主页文档,或者从古老的维基百科开始了解概述。

在评论中的问题后进行编辑:

特别是,请参阅功能支持矩阵了解 PostGIS 可以为您做什么。
计算两点之间的距离是一项标准功能。您可以将其用于各种数据类型。使用哪种数据类型?请参阅常见问题解答中的问题以及其中的更多链接。

PostgreSQL has support for what you are talking about on board. But for a lot more functionality (and for what the "someone" you mention was probably thinking about) turn to PostGIS.

See the home page, documentation, or start at good old Wikipedia for an overview.

Edit after question in comment:

In particular, see the function support matrix to get an impression what PostGIS can do for you.
Computing the distance between two points is a standard feature. You can have that for a variety of data types. Which data type to use? See this question in the FAQ and further links there.

‘画卷フ 2024-12-18 13:29:00

如果只是点的话,MySQL还可以。如果您有更复杂的几何形状,例如送货路线或单元接收区域或其他什么,您需要 PostGIS,因为它支持更复杂的几何数据索引(r 树)。对于空间数据来说,MyISAM 实际上比 InnoDB 更好,顺便说一句,因为它还支持 r 树空间索引(但不像 PostGIS 那样强大的查询)。不过,如果您只需要点,InnoDB 或 MyISAM b 树就足够了。如果边界框足够了(即,您需要围绕某个点的矩形平面内的所有内容),那么基于 geohash 的索引就可以了。有关所有内容的更多背景 在这里。熟悉 PostGIS 和 Postgres 是非常值得的,它们都是非常好的项目,也是迄今为止我最喜欢的关系数据库,但仅仅查找点并不需要它们。

If it is just points, MySQL is fine. If you have more complex geometries, like delivery routes, or cell reception areas, or whatever, you want PostGIS, because it supports more sophisticated indexing of geometric data (r-trees). MyISAM is actually better than InnoDB for spatial data, BTW, because it also supports r-tree spatial indexes (but not as powerful queries as PostGIS.) If you just need points, though, InnoDB or MyISAM b-trees are adequate. If bounding boxes are enough (ie, you need everything within a rectangular plane around some point), then geohash-based indexes are ok. More background on all that here. It is well worth the trouble getting familiar with PostGIS and Postgres, they are both remarkably good projects and by far my preferred relational db, but just looking up points does not require them.

迷迭香的记忆 2024-12-18 13:29:00

您还可以检查 MonogDB,它支持地理空间索引,让您非常有效地查询最近的对象!这就是 Foursquare 的人用来寻找最近场地的方法......

You could also check the MonogDB, it supports geospatial indexing letting you query for nearest objects very effectively ! Thats what the guys at Foursquare using to find nearest venues ...

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