scale buckets programatically

Shantha, Raghavendra Vasanth raghu at KU.EDU
Wed Mar 16 13:23:03 EST 2005


Hi All,

I am new to Mapserver/mapscript.

I am trying to do "scale buckets" on a AIG (Arc/Info Grid) raster file.

Here is a snippet of the code (python mapscript):
#MapObj done
#LayerObj done


# Scale Buckets in LayerObj
    lyr.classitem = '[pixel]'
    lyr.addProcessing('BANDS=1')
    lyr.addProcessing('SCALE=13,96')
    lyr.addProcessing('SCALE_BUCKETS=2')
   
    
    clsRed = mapscript.classObj(lyr)
    clsRed.name = 'red'

    clsRed.setExpression('[pixel] < 10.0')
    styleo = mapscript.styleObj(clsRed)
    styleo.color.setRGB(255,0,0)


    clsGreen = mapscript.classObj(lyr)
    clsGreen.name = 'green'
    
    clsGreen.setExpression('[pixel] >=10.0')
    styleo = mapscript.styleObj(clsGreen)
    styleo.color.setRGB(0,255,0)



If I render the AIG (Arc/Info Grid) raster file using the above code, I
always get a "white" image (=> no features are selected). 
(the SCALE=13,96 limits were obtained using gdalinfo <raster rile>)


I don't know where I am going wrong. Any ideas?

Thanks,
Raghu



More information about the mapserver-users mailing list