[Mapserver-users] GDAL support for classed rasters in nightly 3.7?

Frank Warmerdam warmerdam at pobox.com
Fri Jan 10 07:10:26 PST 2003


Antti.Roppola at brs.gov.au wrote:
> Hello all,
> 
> I have built 3.7 using the nightly tarball from the day before.
> 
> Most things in the 3.6 map work un-modified, but classed rasters do not display
> (a continuous tone ERDAS Imagine file still works). This suggests something
> to do with the CLASS object:
> 
> 	LAYER
> 	  NAME "My Layer"
> 	  TYPE RASTER
> 	  STATUS OFF
> 	  DATA myraster.bil        ##  (.tif or Grid for that matter)
> 	  CLASSITEM "[pixel]"
> 	  CLASS
> 	    NAME "Class 1"
> 	    EXPRESSION ([pixel] ==1)
> 	    COLOR 255 0 0
> 	  END
> 	END
> 
> The 3.7 migration doco suggests CLASS should be backward compatible in most instances.
> Am I seeing a vagary in the nightly, or should I be re-writing the above as a STYLE? Inserting
> "DEBUG 1" into the layer merely induces a getSymbol() error message.
> 

Antti,

I found a few problems contributing to this failing:

  o The code in mapdrawgdal.c that was checking the class colors was not first
    calling RESOLVE_PEN_GD() so the pen value wasn't set and the color wasn't
    valid.  This problem seems to be shared with all the other classified raster
    code in mapraster.c, so I have fixed them to.

  o The MS_TRANSPARENT_COLOR() macro seemed to be returning MS_TRUE and MS_FALSE
    reversed from what they should be.  I have corrected this macro in map.h.

  o mapdrawgdal.c was applying the CVT macro to red, green and blue values
    pulled from sEntry.  This is an error and I have removed used of this
    macro.  This was improperly copied from the libtiff based renderer I
    think.

I have committed the changes, and also added a raster "classification" test
to the automated testsuite (msautotest/gdal/classtest1.map) that should
warn us if the classification support gets so badly broken again.

Please do a CVS update and let me know if you encounter any additional problems
with raster classification.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the MapServer-users mailing list