Skip to main content
Solved

How to change data in GEOMETRY column

  • October 30, 2024
  • 2 replies
  • 96 views

scootercat_nl
Contributor
Forum|alt.badge.img+5

I have a SPATIAL table with the following columns: X_coord, Y_coord and a SPATIAL column GEOMETRY

The X and Y coordinates are adjusted. With which attribute can I adjust the GEOMETRY columns?

It has data_type SDO_GEOMETRY (Oracle).

 

Contents of a record:

MDSYS.SDO_GEOMETRY(2001, 28992, MDSYS.SDO_POINT_TYPE(201234.5678, 47123.4567, NULL), NULL, NULL)

 

 

Best answer by s.jager

First of all: if you can, change your datamodel. You are duplicating data now, which is not necessary. It’s easy enough using a view some application needs the X and Y separately in columns instead of as sdo_geometry, or even virtual columns (this being Oracle).

Secondly: That’s really easy to do in just sql:

update geo_table a set a.geometry=
(select
SDO_GEOMETRY(2001,
4326,MDSYS.sdo_point_type(b.X,b.Y, NULL),NULL, NULL)
from coord_table b
where a.id=b.id);

This of course assumes you have a column id that uniquely identifies every row. If you don’t, then you really should add one, because if you don’t have a unique identifier then you will end up either updating all rows in the table, or making the above sql a bit more complicated and less reliable/performant.

Third: if you can only use FME, and have no other options, then have a look at the VertexCreator. That will do what you want.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

s.jager
Influencer
Forum|alt.badge.img+18
  • Influencer
  • 154 replies
  • Best Answer
  • October 30, 2024

First of all: if you can, change your datamodel. You are duplicating data now, which is not necessary. It’s easy enough using a view some application needs the X and Y separately in columns instead of as sdo_geometry, or even virtual columns (this being Oracle).

Secondly: That’s really easy to do in just sql:

update geo_table a set a.geometry=
(select
SDO_GEOMETRY(2001,
4326,MDSYS.sdo_point_type(b.X,b.Y, NULL),NULL, NULL)
from coord_table b
where a.id=b.id);

This of course assumes you have a column id that uniquely identifies every row. If you don’t, then you really should add one, because if you don’t have a unique identifier then you will end up either updating all rows in the table, or making the above sql a bit more complicated and less reliable/performant.

Third: if you can only use FME, and have no other options, then have a look at the VertexCreator. That will do what you want.


scootercat_nl
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 19 replies
  • October 30, 2024

@s.jager 

Thank you for your detailed explanation.

I can get by with this.