Convert KML to SDO_GEOMETRY
793484Aug 24 2010 — edited Aug 25 2010I'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?