Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#1168 closed defect (fixed)

Occasional pixel render failure in rasters using class expression

Reported by: hrz@… Owned by: warmerdam
Priority: normal Milestone:
Component: MapServer C Library Version: 4.4
Severity: minor Keywords:
Cc:

Description

A pixel in certain rasters will be rendered as a transparent pixel when in fact
a class expression should result in it being rendered with a specific colour.  

This problem is reproducible with the appropriate data set. I will upload a 16
col x 11 row ESRI grid file and associated mapfile which demonstrates this. This
can then be rendered using the shp2img utility to produce the faulty output. I
will also upload the output as a PNG. 

Thinking it might be a file format issue I converted the .grd file to a .tiff
using gdal_translate but the problem persisted. Also changing the class
EXPRESSION in the mapfile seems to have no effect (see commented examples in the
mapfile). 

Changing the data values does have an affect. In the test data set the value
that is not rendered is at col 9 row 7 (9,7). Changing the value of pixel (8,7)
to 0.8 results this pixel becoming the badly rendered one.

I noticed this bug in mapserver 4.2 but it is still evident in 4.4. 

Mapserver was compiled as:
./configure --prefix=/home/hrz --with-gd=/usr/local/ --with-proj --with-postgis
--with-tiff=/usr/local/ --with-gdal

My environment is:
uname -m = i686
uname -r = 2.4.21-27.ELsmp
uname -s = Linux
uname -v = #1 SMP Wed Dec 1 21:59:02 EST 2004

Attachments (3)

test.map (703 bytes ) - added by hrz@… 19 years ago.
Mapfile for displaying testcase raster
test.grd (2.0 KB ) - added by hrz@… 19 years ago.
Testcase raster
output.png (2.3 KB ) - added by hrz@… 19 years ago.
PNG image displaying faulty rendering

Download all attachments as: .zip

Change History (8)

by hrz@…, 19 years ago

Attachment: test.map added

Mapfile for displaying testcase raster

by hrz@…, 19 years ago

Attachment: test.grd added

Testcase raster

by hrz@…, 19 years ago

Attachment: output.png added

PNG image displaying faulty rendering

comment:1 by sdlime, 19 years ago

Cc: warmerdam@… added

comment:2 by hrz@…, 19 years ago

I forgot to mention the versions of the various libraries that I compiled
mapserver against:

GDAL 1.2.0.0, released 2004/03/10
GD 2.0.22
PROJ4 Rel. 4.4.7, 31 March 2003
LIBTIFF, Version 3.6.1
Postgis 0.8.1

comment:3 by fwarmerdam, 19 years ago

Cc: steve.lime@… added; warmerdam@… removed
Owner: changed from sdlime to fwarmerdam
I'll "seize" this from Steve as I assume the problem is in my raster code.

comment:4 by fwarmerdam, 19 years ago

Resolution: fixed
Status: newclosed
Internally the classification code in MapServer needs to convert floating point
data into 65536 "buckets" which are preclassified. If you don't provide explicit
details on how this scaling should be done, it does it based on the min/max of
the provided data.  

This generally works well but I found in your case the pixels that were
misclassified where treated as being over the max by a tiny bit after various
processing steps due to rounding error. 

my fix is to very slightly increasing the scaling auto-scaling range and this
corrects the problem with your dataset.  

The fix has been committed in 4.5 and 4.4 branches of MapServer CVS.  In the
meantime you can also explicitly set the scaling controls via processing
directives.  Let me know if you need details on this though it should be 
covered in the mapserver 4.4 raster howto.

Thanks for the very nice test case!

comment:5 by hrz@…, 19 years ago

Frank, thank you very much; it's great to have such a speedy, thoughtful solution!
Setting the SCALE processing directive appropriately worked for us :) (using
MapServer 4.2)
Note: See TracTickets for help on using tickets.