SDO_UTIL.TO_WKTGEOMETRY Adds Extra Precision To The Coordinates (Doc ID 1090738.1)

Last updated on APRIL 26, 2013

Applies to:

Oracle Spatial - Version 10.2.0.4 to 11.1.0.7 [Release 10.2 to 11.1]
Information in this document applies to any platform.
***Checked for relevance on 26-Apr-2013***

Symptoms

Converting a geometry from an SDO_GEOMETRY type to a CLOB/BLOB and back using:
     SDO_UTIL.TO_WKTGEOMETRY
     SDO_UTIL.FROM_WKTGEOMETRY
     SDO_UTIL.TO_WKBGEOMETRY
and
     SDO_UTIL.FROM_WKBGEOMETRY
returns incorrect results. For instance, this ordinate:
     -73.97256600000000000000
incorrectly becomes:
     -73.97256600000000048567
in the following example:

SQL> select a.geom.sdo_point.x geom,
  2         geom_clob,
  3         geom_blob
  4    from test a;

GEOM GEOM_CLOB
-------------------------- ---------------------------------------------
GEOM_BLOB
---------------------------------------------
-73.97256600000000000000



SQL> update test a
  2    set a.geom_clob = mdsys.sdo_util.to_wktgeometry(geom);

1 row updated.

SQL> update test a
  2    set a.geom_blob = mdsys.sdo_util.to_wkbgeometry(geom);

1 row updated.

SQL> select a.geom.sdo_point.x geom,
  2         geom_clob,
  3         geom_blob
  4    from test a;

GEOM GEOM_CLOB
-------------------------- ---------------------------------------------
GEOM_BLOB
---------------------------------------------
-73.97256600000000000000 POINT (-73.972566 0.0)
0000000001C0527E3E8576CCE60000000000000000


SQL> update test a
  2    set a.geom = mdsys.sdo_util.from_wktgeometry(geom_clob);

1 row updated.

SQL> select a.geom.sdo_point.x geom
  2    from test a;

GEOM
--------------------------
-73.97256600000000048567

SQL> update test a
  2    set a.geom = mdsys.sdo_util.from_wkbgeometry(geom_blob);

1 row updated.

SQL> select a.geom.sdo_point.x geom
  2    from test a;

GEOM
--------------------------
-73.97256600000000048567

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms