如何更改 Oracle SDO_GEOMETRY 的 SRID

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14707442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 04:50:14  来源:igfitidea点击:

How do I change the SRID's for Oracle SDO_GEOMETRY

oracleoracle-spatial

提问by GIS-Jonathan

I have spatial data that Oracle has assigned an SRID of 81989. I'd like to change it to 27700- they're both the same coordinate system, its just Oracle uses its own SRID; so no re-projection is necessary (as such SDO_CS.TRANSFORMdoesn't work as it actually changes the coordinates too, which I don't want)).

我有 Oracle 分配的 SRID 为81989 的空间数据。我想将其更改为27700- 它们都是相同的坐标系,只是 Oracle 使用自己的 SRID;所以不需要重新投影(因此SDO_CS.TRANSFORM它不起作用,因为它实际上也改变了坐标,我不想要))。

I've updated USER_SDO_GEOM_METADATAeasily enough, but the SDO_GEOMETRYcontaining the data itself has the SRID too and I don't know how to change this.

我已经USER_SDO_GEOM_METADATA很容易更新了,但是SDO_GEOMETRY包含数据本身也有 SRID,我不知道如何更改它。

So for example my current data looks like:

例如,我当前的数据如下所示:

MDSYS.SDO_GEOMETRY(2001,81989,MDSYS.SDO_POINT_TYPE(420531.663898,268911.956161,NULL),NULL,NULL)

and I need to go change it to:

我需要将其更改为:

MDSYS.SDO_GEOMETRY(2001,27700,MDSYS.SDO_POINT_TYPE(420531.663898,268911.956161,NULL),NULL,NULL)

For all rows in a table. But I don't know how to automatically alter a single element in a SDO_GEOMETRY while leaving the other aspects of the array unchanged.

对于表中的所有行。但我不知道如何自动更改 SDO_GEOMETRY 中的单个元素,同时保持数组的其他方面不变。

Can anyone point me in the direction? Thanks.

任何人都可以指出我的方向吗?谢谢。

回答by Brian Camire

To update the SRID, you might use something like this:

要更新 SRID,您可以使用以下内容:

UPDATE YOUR_TABLE T
SET T.YOUR_SDO_GEOMETRY_COLUMN.SDO_SRID = 27700
WHERE T.YOUR_SDO_GEOMETRY_COLUMN IS NOT NULL

Note that use of a table alias (like T in this example) is necessary.

请注意,必须使用表别名(如本例中的 T)。