Bummer.

This might be grasping at straws, but does it make any difference if
you use an iterator ?

For example...

RenderedImage rImg = cov.getRenderedImage();
TiledImage tImg = new TiledImage(rImg, true);
WritableRectIter iter = RectIterFactory.createWritable(tImg, null);
float c = (float)100;
for (int y = tImg.getMinY(); y <= tImg.getMaxY(); y++) {
    for (int x = tImg.getMinX(); x <= tImg.getMaxX(); x++) {
        iter.setSample(c);
    }
    iter.nextLine();
    iter.startPixels();
}

Michael


> for (int numXtiles=0; numXtiles<tImg .getNumXTiles(); numXtiles++){
>        for (int numYtiles=0; numYtiles<tImg .getNumYTiles(); numYtiles++){
>                WritableRaster wr = tImg.getWritableTile(numXtiles, numYtiles);
>                for (int yy=0; yy<wr.getHeight(); yy++){
>                        for (int xx=0; xx<wr.getWidth(); xx++){
>                                wr.setSample(wr.getMinX()+xx, wr.getMinY()+yy, 
> 0, c);
>                        }
>                }
>                tImg.releaseWritableTile(numXtiles, numYtiles);
>        }
> }


2008/9/28 Oleg72 <[EMAIL PROTECTED]>:
>
> Unfortunately it does not work
> I tried:
> RenderedImage rImg = cov.getRenderedImage();
> TiledImage tImg = new TiledImage(rImg, true);
> float c = (float)100;
> for (int numXtiles=0; numXtiles<tImg .getNumXTiles(); numXtiles++){
>        for (int numYtiles=0; numYtiles<tImg .getNumYTiles(); numYtiles++){
>                WritableRaster wr = tImg.getWritableTile(numXtiles, numYtiles);
>                for (int yy=0; yy<wr.getHeight(); yy++){
>                        for (int xx=0; xx<wr.getWidth(); xx++){
>                                wr.setSample(wr.getMinX()+xx, wr.getMinY()+yy, 
> 0, c);
>                        }
>                }
>                tImg.releaseWritableTile(numXtiles, numYtiles);
>        }
> }
>
> On the loop 1880 program is terminated with the following error:
> "Exception in thread "main" java.lang.RuntimeException: Cannot construct
> DataBuffer."
>
>
>
> Michael Bedward wrote:
>>
>> try this...
>>
>> RenderedImage rImg = cov.getRenderedImage();
>> TiledImage tImg = new TiledImage(rImg, true);
>>
>> then work with the TiledImage which, in effect, is a writable view of
>> your coverage's raster
>>
>> Caveat: I haven't done this with really large coverages.
>>
>> Let us know how you go.
>>
>> Michael
>>
>> 2008/9/27 Oleg72 <[EMAIL PROTECTED]>:
>>>
>>> Dear All,
>>> I am trying to read and edit large ESRI Ascii Grid.
>>> To edit small grids the following works fine:
>>> (WritableRaster)RenderedImage().getData();
>>>
>>> Unfortunately this approach does not work with large Grids.
>>> * Is there a way to make GridCoverage2D created from large ascii Grid
>>> editable?
>>>
>>> At the moment the only way to solve this problem is to create new
>>> GridCoverage2D using GridCoverageBuilder and copy data (floating) into
>>> it.
>>> The only problem at the moment is to define number of digits after
>>> decimal
>>> point.
>>> If I am writing value 0.001 and reading it back I am getting 0.0 same
>>> problem with saving grid to file.
>>> * How do I define the number of decimal places for values stored in
>>> GridCoverage2D?
>>> Any help would be highly appreciated.
>>> Oleg
>>> --
>>> View this message in context:
>>> http://www.nabble.com/WritableRaster-and-GridCoverageBuilder-tp19690976p19690976.html
>>> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>>>
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great
>>> prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>> world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> _______________________________________________
>>> Geotools-gt2-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/WritableRaster-and-GridCoverageBuilder-tp19690976p19704613.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to