Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#3253 closed defect (fixed)

Raster map can't render from a Oracle Spatial data source.

Reported by: xxj Owned by: warmerdam
Priority: high Milestone: 5.6 release
Component: GDAL Support Version: unspecified
Severity: normal Keywords: raster, oracle, spatial, georaster
Cc: ilucena, EliL

Description

Version:5.6.0, source code OS: Redhat Linux Database version:Oracle11gr1(Oracle Spatial included) Steps: 1.Install Oracle database into the server 2.Install the required library such as GDAL, libxml, curl and so on. 2.Configure Oracle GeoRaster support into the MapServer. The followings are the output summary:

MapServer is now configured for

-------------- Compiler Info -------------

C compiler: gcc -O2 -fPIC -Wall C++ compiler: g++ -O2 -fPIC -Wall Debug: Generic NINT:

-------------- Renderer Settings ---------

OpenGL support: zlib support: -DUSE_ZLIB png support: palette rgba png support: jpeg support: iconv support: -DUSE_ICONV AGG support: -DUSE_AGG Cairo (SVG,PDF) support: Ming(flash) support: PDFLib support:

-------------- Support Libraries ---------

Proj.4 support: -DUSE_PROJ Libxml2 support: -DUSE_LIBXML2 FriBidi support: Curl support: -DUSE_CURL FastCGI support: Threading support: GEOS support:

-------------- Data Format Drivers -------

native tiff support: PostGIS support: EPPL7 support: -DUSE_EPPL ArcSDE support: OGR support: -DUSE_OGR GDAL support: -DUSE_GDAL Oracle Spatial support: -DUSE_ORACLESPATIAL

-------------- OGC Services --------------

WMS Server: -DUSE_WMS_SVR WMS Client: -DUSE_WMS_LYR WFS Server: -DUSE_WFS_SVR WFS Client: -DUSE_WMS_LYR WCS Server: -DUSE_WCS_SVR SOS Server:

3.Compile MapServer and get the CGI executable application 4.Install Apache(the latest version from the official website) 5.Make all settings on Apache server including CGI folder, environment arguments(ORACLE_HOME, LD_LIBRARY_PATH and so on) 6.Create two map files. One(map_point_layer.map) is as the below:

MAP

NAME map_point_layer STATUS ON CONFIG "MS_ERRORFILE" "/home/oracle/mapserver.log" SIZE 600 600

# EXTENT 388107.634400379 5203120.88405952 500896.339019834 5310243.30613897

EXTENT -157.80423 21.31725 -71.017892 61.178368 IMAGETYPE PNG

PROJECTION

"init=epsg:4326"

END

WEB

IMAGEPATH "/tmp/" IMAGEURL "/tmp/"

END

LAYER NAME cities TYPE point STATUS ON CONNECTIONTYPE oraclespatial CONNECTION "mvdemo11g/mvdemo11g@orclat18" DATA "location from cities using srid 8307" CLASS

STYLE

SYMBOL 2 COLOR 255 0 0 POSITION CC

END

END

END

END

END

The other one(map_raster_layer.map) is this look:

MAP

NAME map_raster_layer STATUS ON CONFIG "MS_ERRORFILE" "/tmp/mapserver.log" SIZE 600 600 EXTENT 388107.634400379 5203120.88405952 500896.339019834 5310243.30613897 IMAGETYPE PNG WEB

IMAGEPATH "/tmp/" IMAGEURL "/tmp/"

END

PROJECTION

"init=epsg:4326"

END LAYER

NAME bluemarble TYPE RASTER STATUS ON DATA "georaster:wz/wz@orclat18,sf_rasters,georaster,georid=101" END

END

Both the two database connection are all right.

Problem: If trying to get a map with the map_raster_layer.map by sending a WMS request or using the tool of shp2img, errors happen. The errors are:

msDrawMap(): Image handling error. Failed to draw layer named 'bluemarble'. msDrawRaster(): Unable to access file. georaster:wz/wz@orclat18,sf_rasters,georaster,georid=101 using full path georaster:wz/wz@orclat18,sf_rasters,georaster,georid=101

If trying to get a map using the map_point_layer.map, everything is OK. The wanted picture can be rendered and obtained not only through a WMS request, but also the tool of shp2img.

If changing the data source in map_raster_layer.map from a Oracle connection to a local raster file, no errors occur and MapServer works well.

So may I assume that, if there is something wrong when MapServer deals with a raster Oracle data source? if MapServer always looks on a raster data source as a local file, but not a potential database connection?

BTW: I am not sure I have selected the right component. If not, please could someone help me to assign the ticket to the right one? Thanks!

Change History (6)

comment:1 by jimk, 14 years ago

MapServer will via GDAL detect the georaster:... data statement. If GDAL cannot open the dataset, then MapServer will try to open the file itself and you get the "Unable to access file" error message.

So in this case, GDAL is unable to open the dataset for some reason. Check your data statement with gdalinfo and make sure you use gdalinfo from the same copy of GDAL that MapServer is using.

comment:2 by warmerdam, 14 years ago

Status: newassigned

I believe the core of this is issue is that MapServer does not support rasters that are not an actual file on disk. For instance I have the same problem with:

  data "GTIFF_DIR:1:/home/warmerda/utm.tif"

This is a valid dataset name that works with GDALOpen, but internally mapserver will try and prepend paths and stuff so we end up with:

shp2img -m test.map -o out.png
msDrawMap(): Image handling error. Failed to draw layer named 'Blad'. <br>
msDrawRasterLayerLow(): Unable to access file. Corrupt, empty or missing file '/wrk/home/warmerda/mapserver/bug3253/./GTIFF_DIR:1:/home/warmerda/utm.tif' for layer 'Blad' <br>

I'm going to attack this problem. I will note that a work around is to create a .VRT file for a georaster or other non-real-file datasources.

eg. 

gdal_translate "georaster:wz/wz@orclat18,sf_rasters,georaster,georid=101"  georaster.vrt

then use the .vrt file in the map file.

comment:3 by warmerdam, 14 years ago

In trunk (r9947) I have changed mapraster.c to use the "Try" versions of the build path functions. These only prepared path components if this makes the result point to a file that exists on disk. This is already used in the wcs code and raster query code.

I'm hesitant to move this into 5.6 branch just before 5.6.2 release since it seems like the sort of fix that could have unanticipated effects and I'd like to give it time to be tested in trunk.

comment:4 by warmerdam, 14 years ago

Cc: ilucena added
Resolution: fixed
Status: assignedclosed

I haven't got any feedback on this, but I'm going to assume things are fine now.

comment:5 by EliL, 13 years ago

Cc: EliL added

Not to reopen the ticket but to add an additional note and ask a question, I ran into what appears to be the same issue on MapServer 5.4.2 with a tiled, jpeg compressed, YCBCR, big tif with external bigtif overviews. Wrapping the file in a vrt made it work on 5.4.2 and motivated an upgrade to the 5.6.x series.

However, more careful reading of this ticket indicates that it is in trunk only, not 5.6.6 from ubuntugis-unstable. Should I expect this fix in the (very near) 6.0 release? I'm not exactly sure of the cause (big tif, jpeg compressed, ycbcr, etc) so I didn't edit the keywords.

comment:6 by warmerdam, 13 years ago

EliL,

The change is part of 6.0 however I don't see how it could impact a case of a regular file.

I don't know why wrapping in a VRT helped you, but I don't think the issue you encountered is the same one this ticket is about. Note that the error message for this ticket can appear for a wide variety of reasons.

Note: See TracTickets for help on using tickets.