From: andyuk <an...@gm...> - 2007-09-20 15:07:25
|
Hi, I'm a little confused with the GridSampleDimension and category classes. I can't find many usage examples on the web. Why won't this work? Category[] cats = { new Category("Green", Color.GREEN, new NumberRange(0,5)), new Category("Red", Color.RED, new NumberRange(6,20)) }; GridSampleDimension[] bands = {new GridSampleDimension("Temperature", cats, null)}; GridCoverage2D gc = (GridCoverage2D) (new GridCoverageFactory()) .create("Coverage", interpolation.getRaster(), interpolation.getEnv(), bands); I get the error: Exception in thread "main" java.lang.IllegalArgumentException: Raster sun.awt.image.SunWritableRaster@c67a88 is incompatible with ColorModel IndexColorModel: #pixelBits = 1 numComponents = 3 color space = java.awt.color.ICC_ColorSpace@96ad7c transparency = 1 transIndex = -1 has alpha = false isAlphaPre = false at java.awt.image.BufferedImage.<init>(Unknown Source) at org.geotools.coverage.grid.GridCoverageFactory.create(GridCoverageFactory.java:395) ..... This code works: Color[] colors = new Color[] {Color.GREEN, Color.Red}; GridCoverage2D gc = (GridCoverage2D) (new GridCoverageFactory()) .create("Coverage", interpolation.getRaster(), interpolation.getEnv(), null, null, null,new Color[][] { colors }, null); How can I define values for the above code? Cheers, Andy -- View this message in context: http://www.nabble.com/GridSampleDimension---Category-confusion-tf4488119.html#a12799005 Sent from the geotools-gt2-users mailing list archive at Nabble.com. |