Changes between Initial Version and Version 1 of Ticket #3711


Ignore:
Timestamp:
Aug 4, 2010, 8:28:56 PM (14 years ago)
Author:
jimmyzhao
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #3711 – Description

    initial v1  
    1 I use GDAL Java API to write raster data to Oracle Spatial GeoRaster Object, and encouter a strange problem:
     1I use GDAL Java API to write raster data to Oracle Spatial GeoRaster Object, and encouter a strange problem:[[BR]]
     2
    23"
    34#
    4 # A fatal error has been detected by the Java Runtime Environment:
     5# A fatal error has been detected by the Java Runtime Environment:[[BR]]
     6
    57#
    6 #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0afa0770, pid=5904, tid=5548
     8#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0afa0770,pid=5904, tid=5548[[BR]]
     9
    710#
    8 # JRE version: 6.0_15-b03
    9 # Java VM: Java HotSpot(TM) Client VM (14.1-b02 mixed mode windows-x86 )
    10 # Problematic frame:
    11 # C  [gdal17.dll+0x190770]
     11# JRE version: 6.0_15-b03[[BR]]
     12
     13# Java VM: Java HotSpot(TM) Client VM (14.1-b02 mixed mode windows-x86 )[[BR]]
     14
     15# Problematic frame:[[BR]]
     16
     17# C  [gdal17.dll+0x190770][[BR]]
     18
    1219#
    1320# An error report file with more information is saved as:
    14 # D:\workspace\GDALTest\hs_err_pid5904.log
     21# D:\workspace\GDALTest\hs_err_pid5904.log[[BR]]
     22
    1523#
    1624# If you would like to submit a bug report, please visit:
    17 #   http://java.sun.com/webapps/bugreport/crash.jsp
    18 # The crash happened outside the Java Virtual Machine in native code.
    19 "
     25#   http://java.sun.com/webapps/bugreport/crash.jsp[[BR]]
     26
     27# The crash happened outside the Java Virtual Machine in native code.[[BR]]
     28
     29"[[BR]]
     30
    2031This is my Java codes:
    21 import org.gdal.gdal.gdal;
    22 import org.gdal.gdalconst.gdalconstConstants;
     32
     33{{{
     34import java.nio.ByteBuffer;
     35
    2336import org.gdal.gdal.Band;
    2437import org.gdal.gdal.Dataset;
    2538import org.gdal.gdal.Driver;
     39import org.gdal.gdal.gdal;
     40import org.gdal.gdalconst.gdalconstConstants;
    2641
    27 import java.nio.ByteBuffer;
    2842
    29 public class GDALTest1 {
     43public class GDALTest3 {
    3044
    31         /**
    32          * @param args
    33          */
    3445        public static void main(String[] args) {
     46
     47                Dataset dataset1;
     48                Dataset dataset2;
    3549               
    36                 Dataset Dataset1;
    37                 Dataset Dataset2;
    38                 Band Band1;
    39                 Band Band2;
     50                Band band1;
     51                Band band2;
     52               
     53                Driver driver;
     54               
    4055                gdal.AllRegister();
    41                 Dataset1 = gdal.Open("georaster:georaster/georaster@localhost:1521/orcl,rdt_2,0");
    42                 Dataset2 = gdal.Open("georaster:georaster/georaster@localhost:1521/orcl,rdt_2,0",
    43                 gdalconstConstants.GA_Update);
    44                 Band1 = Dataset1.GetRasterBand(1);
    45                 Band2 = Dataset2.GetRasterBand(1);
    46                 Dataset2.SetProjection(Dataset1.GetProjection());
    47                 Dataset2.SetGeoTransform(Dataset1.GetGeoTransform());
    48                 System.out.println("Passing information from input dataset to output dataset");
    49                 int XSize = 100;
    50                 ByteBuffer buffer = ByteBuffer.allocateDirect(XSize);
    51                 buffer = Band1.ReadRaster_Direct(0,0,XSize,1);
    52                 Band2.WriteRaster_Direct(0,0,XSize,1,buffer);
    53                 Dataset2.FlushCache();
    54                 System.out.println(buffer.getLong());
    55                 Dataset1.delete();
    56                 Dataset2.delete();
     56               
     57                driver = gdal.GetDriverByName("georaster");
     58               
     59                dataset1 = gdal.Open("geor:georaster/georaster@orcl,rdt_01,1");
     60                band1 = dataset1.GetRasterBand(1);
     61               
     62                int xSize = dataset1.getRasterXSize();
     63                int ySize = dataset1.getRasterYSize();
     64                int bands = dataset1.getRasterCount();
     65               
     66                String options[] = new String[]{"INSERT=VALUES(103, 'new.tif', SDO_GEOR.INIT('rdt_01',3))", "BLOCKXSIZE=512", "BLOCKYSIZE=512"};
     67                dataset2 = driver.Create("georaster:georaster/georaster,,georaster_table,georaster",
     68                                xSize, ySize, bands, band1.getDataType(), options);
     69               
     70                dataset2.SetGeoTransform(dataset1.GetGeoTransform());
     71                dataset2.SetProjection(dataset1.GetProjection());
     72               
     73                band2 = dataset2.GetRasterBand(1);
     74               
     75                ByteBuffer buffer = ByteBuffer.allocateDirect(xSize);
     76               
     77                for( int i =0; i < ySize; i++ ) {
     78                       
     79                        buffer = band1.ReadRaster_Direct(0,i,xSize,1);
     80                       
     81                        band2.WriteRaster_Direct(0,i,xSize,1,buffer);
     82                }
     83               
     84                dataset2.FlushCache();
     85               
     86                System.out.println("generate a new georaster : " + dataset2.GetDescription());
     87               
     88                dataset1.delete();
     89                dataset2.delete();             
    5790        }
    5891
    5992}
     93}}}
     94
     95
    6096
    6197When executing the sentence "Dataset2.FlushCache();", the above problem rises.
    6298
    63 The exact error report is attached.
     99By the way, I can use gdal_translate to load GTiff file to Oracle Georaster database successfully, and I can also export Oracle Spatial GeoRaster data to GTiff file with GDAL Java API. But why can't I use GDAL Java API to load GTiff file to Oracle GeoRaster database?
     100
     101The version of GDAL is 1.7.1, and it is compiled with Visual Studio 2008. The GTiff image is 183MB with 3 bands.
     102 
     103The log of exact error is attached.