如何更改几何列的SRID?

发布于 2024-09-05 01:23:10 字数 296 浏览 2 评论 0原文

我有一个表,其中一列是具有 SRID 的多边形的几何列 the_geom。我在同一个表中添加了一个新列,其几何数据与 the_geom 完全相同。

这个新列的名称为 the_geom4258,因为我想将其 SRID 设置为 4258。将几何体的 SRID 更改为另一个坐标系的过程是什么?应用以下查询是否足够:

UPDATE table SET the_geom4258=ST_SetSRID(the_geom4258,4258);

I have a table where one of the columns is a geometry column the_geom for polygons with an SRID. I added a new column in the same table with exactly the same geometry data as the_geom.

This new column has the name the_geom4258 because I want to set its SRID to 4258. What is the procedure to change the geometry's SRID to another coordinate system? Is it enough to apply the following query:

UPDATE table SET the_geom4258=ST_SetSRID(the_geom4258,4258);

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

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

发布评论

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

评论(1

陌上青苔 2024-09-12 01:23:10

您应该使用 ST_Transform 函数。还可以使用函数 AddGeometryColumn 创建新列,以确保所有必要的约束也都满足创建:

SELECT AddGeometryColumn('table','the_geom4258',4258, 'POLYGON', 2);

UPDATE table SET the_geom4258 = ST_Transform(the_geom,4258);

ST_SetSRID 只是设置投影标识符,但实际上并不转换几何图形。

You should use the ST_Transform function. Also use the function AddGeometryColumn to create your new column, to ensure all the necessary constraints are also created:

SELECT AddGeometryColumn('table','the_geom4258',4258, 'POLYGON', 2);

UPDATE table SET the_geom4258 = ST_Transform(the_geom,4258);

ST_SetSRID just sets the projection identifier, but does not actually transform the geometries.

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