This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,987 Users
  • 2,269,775 Discussions
  • 7,916,823 Comments

Discussions

Convert KML to SDO_GEOMETRY

793484
793484 Member Posts: 15
edited Aug 25, 2010 8:50AM in General Database Discussions
I'm trying to convert a KML file into SDO_GEOMETRY to load into a table for use with mapviewer. After searching documentation and the Internet colleague and I came up with the following:
DECLARE
dest_clob CLOB;
src_clob BFILE := BFILENAME('EXAMPLE_LOB_DIR', 'test.kml');
dst_offset number := 1 ;
src_offset number := 1 ;
lang_ctx number := DBMS_LOB.DEFAULT_LANG_CTX;
warning number;
sdo_geom SDO_GEOMETRY;
BEGIN
DBMS_LOB.FILEOPEN(src_clob, DBMS_LOB.FILE_READONLY);
DBMS_LOB.CREATETEMPORARY(dest_clob,true);
DBMS_LOB.LoadFromFile(
dest_clob
, src_clob
, DBMS_LOB.GETLENGTH(src_clob)
);
DBMS_LOB.FILECLOSE(src_clob);

sdo_geom := SDO_UTIL.FROM_KMLGEOMETRY(dest_clob);
insert into cities(city, location, state_abrv, pop90, rank90)
values('Harpers Ferry', sdo_geom, 'NE', 30000, 175);

COMMIT;
END;
/

However, we're getting this error:
Error report:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.RuntimeException: Message:KML Geometry type kml not supported.
Description:
ORA-06512: at "MDSYS.SDO_UTIL", line 232
ORA-06512: at line 19
29532. 00000 - "Java call terminated by uncaught Java exception: %s"
*Cause: A Java exception or error was signaled and could not be
resolved by the Java code.
*Action: Modify Java code, if this behavior is not intended.

It appears as though SDO_UTIL.FROM_KMLGEOMETRY (line 19) is erroring out because it cannot accept KML input. Since that probably isn't the case, something else must be wrong, but neither my colleague nor I know what we're doing wrong. Can anyone help us?
Tagged:

Answers

This discussion has been closed.