使用 PostGIS 拥有通用 GEOGRAPHY 列

发布于 2024-10-02 16:25:56 字数 313 浏览 1 评论 0原文

在 PostgreSQL 9 + PostGIS 1.5 中,有没有办法创建“通用”GEOGRAPHY 列?我的意思是一个可以接受 POINT 以及 POLYGON、LINESTRING 等的列。到目前为止,我只在 Internet 上看到过像 GEOGRAPHY(POINT,4326) 这样的列。

如果这是不可能的,那么您将如何设计(从数据库的角度)链接到随机地理对象(点、多边形等)的实体?我应该为我想要支持的每种类型的地理对象创建 3、4、5 个不同的表吗? (1 个用于 POINT 对象的表,1 个用于 POLYGON 对象的表等)?

提前致谢。

罗曼

In PostgreSQL 9 + PostGIS 1.5, is there a way to create a "generic" GEOGRAPHY column? By that I mean a column that would accept POINTs as well as POLYGONs, LINESTRINGs, etc. Until now, I've only seen columns like GEOGRAPHY(POINT,4326) on the Internet.

If that is not possible, then how would you design (from a DB point of view) an entity that is linked to a random geographical object (point, polygon, whatever)? Should I create 3, 4, 5 different tables for each type of geographical object I'd like to support? (1 table for POINT objets, 1 table for POLYGON objects and so on)?

Thanks in advance.

Romain

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

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

发布评论

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

评论(1

你的笑 2024-10-09 16:25:56

是的,只是不要在 CREATE TABLE 语句中指定类型约束。

CREATE TABLE mytable ( geog GEOGRAPHY, id SERIAL PRIMARY KEY );

Yes, just don't specify a type constraint in the CREATE TABLE statement.

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