如何更改 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
How do I change the SRID's for Oracle SDO_GEOMETRY
提问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.TRANSFORM
doesn'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_METADATA
easily enough, but the SDO_GEOMETRY
containing 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)。