Hi dear everyone, especially Michael Bedward,

I´m trying to build upon your
org.geotools.demo.coverage.WritableGridDemo.java example, because I
need to create my own  Arc Grid Coverage. In your example you only
invoke writableCov.show(); when finished. I want to modify the values
of the raster and then save them in an ArcGrid coverage. The problem
is, if I want to have a more realistic coverage, with X and Y
dimensions different (not a square) when I go to save that coverage,
using :
//        writableCov.show();
        String coveragePath= "covargeResult.asc";
        File outasc = new File(lsaResult);
        if (outasc.exists())
            outasc.delete();
        ArcGridWriter agw;
        agw = new ArcGridWriter(outasc);
        agw.write(writableCov, null);

It will show the following exception:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
        at 
com.sun.media.jai.iterator.WritableRandomIterFallback.makeCurrentWritable(WritableRandomIterFallback.java:33)
        at 
com.sun.media.jai.iterator.WritableRandomIterFallback.setSample(WritableRandomIterFallback.java:59)
        at 
edu.unimelb.climatechange.lsa.WritableGridCoverage2D.flushCache(WritableGridCoverage2D.java:240)
        at 
edu.unimelb.climatechange.lsa.WritableGridCoverage2D.getRenderedImage(WritableGridCoverage2D.java:135)
        at 
org.geotools.gce.arcgrid.ArcGridWriter.writeGridCoverage(ArcGridWriter.java:250)
        at org.geotools.gce.arcgrid.ArcGridWriter.write(ArcGridWriter.java:506)

I tried to look into the code and debugging it, thinking it was just a
matter of setting somewhere the right dimensions to avoid this
ArrayIndexOutOfBoundsException, but I can't fin way to do it. I know
the ArcGridWriter can receive Parameters, like:
ParameterValueGroup params = agw.getFormat().getWriteParameters();
         params.parameter("Compressed").setValue(compressOutput);

 but I can't find one for dimensions, or I couldn't find an example in
the internet that does.

Thank you very much for any light you can shed in here,  best regards


Marcos Nino-Ruiz
Computer and Systems engineer
CRC for Spatial Information
The University of Melbourne
Victoria 3010
Australia

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to