Showing results for 
Search instead for 
Do you mean 

Converting Z values in 3D spatial data

by Moderator ‎02-15-2016 01:38 PM - edited ‎04-06-2016 11:41 AM (361 Views)

Question

You have 3D spatial data stored in Oracle's SDO_GEOMETRY but the Z values are incorrect.  How can you change them all to a constant Z value like zero?

Answer

Here is a simple solution that converts the 3D geometry to 2D and then back to 3D again using a constant Z. The original 'bad' Z values are stripped off and replaced with the constant Z value at the end of the conversion:

 

UPDATE MY_TABLE SET G3E_GEOMETRY = SDO_CS.MAKE_3D(SDO_CS.MAKE_2D(G3E_GEOMETRY), 0, NULL);

 

 

Contributors