Note: the following is about the demo there:
http://svn.geotools.org/geotools/trunk/gt/demo/coverage/src/main/java/org/geotools/demo/coverage/FloatRasterDemo.java

Gabriella Turek a écrit :
> How do I make the image layer transparent?

The GridCoverageFactory.create(...) method used in the demo was an other 
convenience method, sligthly more elaborated then the one with float[][] 
argument. If you need more control, we need to go one other level in the 
'create' method (i.e. choose one a little bit less convenient). You need to 
create GridSampleDimension explicitly; this is the path that give the maximum 
control.

Choose a linear relationship going from your floating point values to some 
integer values in the range 1 to 255 inclusive. Lets assume that this linear 
relationship is expressed by 'scale' and 'offset' double values. Then (replace 
"Temperature" by the actual name of your data; also select a Unit appropriatly. 
Note that the Category and SampleDimension name doesn't need to be the same):

   Category nodata = Category.NODATA;
   Category data = new Category("Temperature", colors, 1, 255, scale, offset);
   GridSampleDimension band = new GridSampleDimension("Temperature", new 
Category[] {nodata, data}, NonSI.CELSIUS);
   GridCoverage2D coverage = GridCoverageFactory.create("Temperature June 1st", 
envelope, new GridSampleDimension[] {band});

        Martin


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to