Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4377 closed defect (fixed)

georaster.py fails on georaster-less oracle's

Reported by: warmerdam Owned by: ilucena
Priority: normal Milestone:
Component: Autotest Version: unspecified
Severity: normal Keywords: georaster
Cc:

Description

Ivan,

The georaster.py script fails each test on my system. I have a working Oracle (recent vintage, details forgotten). I am guessing the problem is that I don't have georaster support in my free version but I may be confused.

If I test georaster with gdal_translate I get:

gdal_translate ~/utm.tif -of georaster geor:warmerda/tiger@localhost,GDAL_TEST,RASTER -co "DESCRIPTION=(id number, raster sdo_georaster)" -co "INSERT=(1001, sdo_geor.init('GDAL_TEST_RDT',1001))"
Input file size is 512, 512
ERROR 1: ORA-04043: object MDSYS.SDO_GEORASTER does not exist

ERROR 1: ORA-06550: line 13, column 5:
PLS-00201: identifier 'SDO_GEOR_UTL.CREATEDMLTRIGGER' must be declared
ORA-06550: line 13, column 5:
PL/SQL: Statement ignored

When I run georaster.py I also get lots of stuff about MDSYS.SDO_GEORASTER not existing.

I'm wondering if georaster_init() in georaster.py ought to test for the existance of MDSYS.SDO_GEORASTER and if not found clear gdaltest.oci_ds so all the tests are skipped (possibly reporting why).

Change History (5)

comment:1 by ilucena, 12 years ago

Frank,

Oracle XE doesn't include Oracle Spatial. The geometry support is provided by Oracle Locator that is included. That is way you still can use the OGR/OCI driver.

1 - If we can use gdaltest.oci_ds.ExecuteSQL to make a query to check if SDO_GEORASTER exist that could be a solution. But it seems to me that ExecuteSQL can't do that.

2 - We could add code in GDALRegister_GEOR to check if sdo_georaster is available canceling the driver registration if it is not.

3 - We could run some Oracle command line tool from python that would tell the version we are running, e.g. "sqlplus -version" and parse the result.

4 - We could just add some environment variable or configuration flag into the autotest code that only if exist then it would run the georaster.py.

What do you prefer?

comment:2 by ilucena, 12 years ago

Frank,

I prefer the option (2) but it seems to me that (3) would be the easiest.

What is the output you when you run this in your system:

>>> import os
>>> p = os.open('sqlplus -version')
>>> p.readlines()
['\n', 'SQL*Plus: Release 10.2.0.1.0 - Production\n', '\n']

comment:3 by warmerdam, 12 years ago

Resolution: fixed
Status: newclosed

Ivan, It seems I have the same version:

warmerda@gdal65[241]% sqlplus -version

SQL*Plus: Release 10.2.0.1.0 - Production

Instead I have added a check to see if a select on ALL_SDO_GEOR_SYSDATA works, which I assumes is a good proxy for checking if the database has georaster support. Could you review the change (r23505) and confirm that it does not disable the georaster.py script on a real georaster enabled database?

comment:4 by ilucena, 12 years ago

Frank,

It didn't worked:

C:\Python25\lib\site-packages\osgeo\gdal.py:89: DeprecationWarning: gdal.py was
placed in a namespace, it is now available as osgeo.gdal
  DeprecationWarning)
  TEST: georaster_init ... skip
    line 85: ALL_SDO_GEOR_SYSDATA inaccesable, likely georaster unavailable.
  TEST: georaster_byte ... skip
  TEST: georaster_int16 ... skip
  TEST: georaster_int32 ... skip
  TEST: georaster_rgb_b1 ... skip
  TEST: georaster_rgb_b2 ... skip
  TEST: georaster_rgb_b3_bsq ... skip
  TEST: georaster_rgb_b3_bip ... skip
  TEST: georaster_rgb_b3_bil ... skip
  TEST: georaster_byte_deflate ... skip
  TEST: georaster_rgb_deflate_b3 ... skip
  TEST: georaster_1bit ... skip
  TEST: georaster_2bit ... skip
  TEST: georaster_4bit ... skip
  TEST: georaster_cleanup ... skip

Test Script: GeoRaster
Succeeded: 0
Failed:    0 (0 blew exceptions)
Skipped:   15
Expected fail:0

I believe it's because err_msg comes blank if there was no error.

>>> from osgeo import gdal
>>> from osgeo import ogr
>>> oci_ds = ogr.Open('OCI:usr/pwd')
>>> gdal.PushErrorHandler( 'CPLQuietErrorHandler' )
0
>>> rs = oci_ds.ExecuteSQL( 'select owner from all_sdo_geor_sysdata' )
>>> gdal.PopErrorHandler()
>>> err_msg = gdal.GetLastErrorMsg()
>>> print err_msg

>>> 

Instead of searching for the string inside the error message, you could just check if there was an error.

What do you think? Do you want me to do it?

comment:5 by ilucena, 12 years ago

Fixed on r23505.

Frank,

That solution works for me now, please let me know if that doesn't work for Oracle Express Edition.

Thanks.

Note: See TracTickets for help on using tickets.