2 Replies Latest reply on Feb 8, 2013 6:25 AM by AlanShar

    Loading GeoTiff in Oracle


      I am trying to load a Raster GeoTiff (has location tags, but extension is .tif) in Oracle Spatial 11.2 version.

      The things I did are :

      --Creating Georaster table
      CREATE TABLE city_images (image_id NUMBER, image_description VARCHAR2(50), image SDO_GEORASTER);

      --creating raster data table
      CREATE TABLE city_images_rdt OF SDO_RASTER
      (PRIMARY KEY (rasterID, pyramidLevel, bandBlockNumber,
      rowBlockNumber, columnBlockNumber))
      -- TABLESPACE im_tbs_1
      LOB(rasterBlock) STORE AS lobseg
      CHUNK 32768

      Created Procedure as follows :

      create or replace
      procedure GEORASTERPROC(imgpath in varchar2) as
      geor SDO_GEORASTER;
      -- Initialize an empty GeoRaster object into which the external image
      -- is to be imported.
      INSERT INTO city_images
      values( 1, 'TIFF', sdo_geor.init('city_images_rdt') );

      -- Import the TIFF image.
      SELECT image INTO geor FROM city_images
      WHERE image_id = 1 FOR UPDATE;
      --sdo_geor.importFrom(geor, NULL, 'GeoTIFF', 'file', imgpath); 
      sdo_geor.importFrom(geor, NULL, 'TIFF', 'file', imgpath);
      UPDATE city_images SET image = geor WHERE image_id = 1;

      *4)* Placed Image on the Oracle server at /home/oracle/ (However I tried it from my local machine as well). The image I have seen in Google Earth and validated with GeoTiff Examiner.

      *5)* Ran the above procedure as follows :
      exec GEORASTERPROC('/home/oracle/ImageRasterizer.tif')

      Now the Error I am getting is :

      ERROR at line 1:
      ORA-13464: error loading GeoRaster data: - Unable to render RenderedOp for this
      ORA-06512: at "MDSYS.MD", line 1723
      ORA-06512: at "MDSYS.MDERR", line 17
      ORA-06512: at "MDSYS.SDO_GEOR", line 5539
      ORA-06512: at "WM_GIS.GEORASTERPROC", line 13
      ORA-06512: at line 1

      What could have gone wrong ?? Please help me i this, I am struggling for many days here.

        • 1. Re: Loading GeoTiff in Oracle
          Jeffrey Xie-Oracle
          Hi Alankar,

          this error mesg shows the tiff image cannot be handled by importFrom, which completely depends upon JAI. how big is the image and how the bands are interleaved in the tiff file? Also, can you run the cliend-side GeoRasterLoader to load the image? It will print the error stack of the java exception in more details.

          JAI has a lot of limitations in handling geospatial images. So, we generally recommend you use GDAL which supports GeoRaster for loading and exporting all GDAL supported formats. (http://www.gdal.org/frmt_georaster.html)

          on the side, a couple of recommendations for your scripts:
          1. always use SecureFile lob when creating the RDT's, which speeds up georaster operations by several times. in other words change "LOB(rasterBlock) STORE AS lobseg" to "LOB(rasterBlock) STORE AS SECUREFILE". (also, remove the name "lobseg" or give a special name for each RDT)
          2. When loading an image into a GeoRaster database, always specify a block size, and it should generally be 256x256 or larger.

          • 2. Re: Loading GeoTiff in Oracle
            Thanks a lot Jeffrey !!