Opened 14 years ago

Last modified 14 years ago

#3230 new defect

SDE Raster - nodata handling

Reported by: amaul Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL Support Version: unspecified
Severity: normal Keywords:
Cc: hobu

Description (last modified by warmerdam)

Source: gdal library 1.6.3, module sderasterband.cpp, lines 420-421:

using the SDE raster layers we get trouble because of the handling of missing values(NODATA):

        // ArcSDE says the block has no data in it.
        // Write 0's and be done with it

While working with classified rasters we are able to avoid a 0 (null) class. But more often we are processing signed float data with 0 as a valid value. Setting nodata values to 0 gives illegal values in the data stream.

It seems to me that there are two solutions:

  1. comprehensive solution:

Adding at least one bit to the data stream to store a probably given nodata bitmask (using the next bigger GDALDataType - if existing -) will solve the problem correctly, but will lead to a slower performance

  1. quick and dirty:

Saying the biggest value of the stream is nodata will work for the most float GDALDataTypes but can produce errors with little data types.

The following expression in a mapfile using raster data should then be interpreted correctly by gdal:

	class
		name "nodata"
		expression ([pixel]=[nodata])
		color	255 255 255
	end

Change History (3)

comment:1 by warmerdam, 14 years ago

Cc: hobu added
Description: modified (diff)
Priority: highnormal

This is really a GDAL issue, and likely ought to be filed there.

The code referenced is for missing blocks which are returned as zeros. There does not seem to be any other nodata handling in the driver so I'm not sure what is returned for blocks with a mixture of data and nodata. I suspect there needs to be broader nodata support in the driver and that the missing blocks should be handled like the rest of it.

I am cc:ing Howard who wrote the SDE driver though I'm not sure if he is in a position to work on it any more.

I will note that one approach to nodata that does not require setting aside specific "nodata" values is to support nodata masks per GDAL RFC 15:

http://trac.osgeo.org/gdal/wiki/rfc15_nodatabitmask

It would be nice if MapServer supported these masks when available.

comment:2 by warmerdam, 14 years ago

Filed as #3378.

comment:3 by hobu, 14 years ago

ArcSDE itself does support GDAL-style MaskBands, but the SDE driver has not been updated to support them. I am not in a position to implement or test any ArcSDE code at this time

Note: See TracTickets for help on using tickets.