Skip to main content

Creating big images

3 replies [Last post]
dispiste
Offline
Joined: 2009-10-02

Hello, I want to create really big images using JAI, which I will finally write to GeoTiff or ArcGRID by using GeoTools.

In order to write the image with GeoTools, I need a Raster or an Image object. I usually use something like this to create the raster:

Raster m_Raster = RasterFactory.createBandedRaster(DataBuffer.TYPE_FLOAT,
60000, 60000, 1, null);

In this way, I can later use this Raster to actually write to disk by using GeoTools.

However, when I use so big sizes, I get the following exception:

java.lang.IllegalArgumentException: Size of array must be smaller than Integer.MAX_VALUE.
at javax.media.jai.RasterFactory.createBandedRaster(RasterFactory.java:307)
....

So I see this is not a valid option to create big images... Is there another option to create a big Raster or Image object with JAI?

Thanks in advance,

César

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cafeanimal
Offline
Joined: 2008-04-29


In addition to Bob's comments, there is also the DiskMemImage class in jai-tools. It's a tiled image that can supplement memory storage of tiles with disk caching to handle large volumes of data:
http://code.google.com/p/jai-tools/wiki/DiskMemImage

Michael

dispiste
Offline
Joined: 2009-10-02

Hello Bob,

I don't need to create it on memory, but I need a raster of this size in order to create the coverage in GeoTools (at least, as far as I know). I think I can use Michael's DiskMemImage to achieve this... I'm currently testing it.

Thanks for your replies.

Regards,

César

Bob Deen

You have to tile the image... so each individual tile (represented by a
Raster) is within the size limit. You can also structure it so that
only one or a few tiles need to be in memory at once, which greatly
helps with the memory footprint. There are mechanisms to retrieve tiles
on demand for that purpose. If you really have the memory though, you
can also create all the tiles at once. In either case, the API
generally works as well with tiled images as it does with untiled.
(that's not *always* the case, but generally it does).

Hope that helps...

-Bob

jai-interest@javadesktop.org wrote:
> Hello, I want to create really big images using JAI, which I will finally write to GeoTiff or ArcGRID by using GeoTools.
>
> In order to write the image with GeoTools, I need a Raster or an Image object. I usually use something like this to create the raster:
>
> Raster m_Raster = RasterFactory.createBandedRaster(DataBuffer.TYPE_FLOAT,
> 60000, 60000, 1, null);
>
> In this way, I can later use this Raster to actually write to disk by using GeoTools.
>
> However, when I use so big sizes, I get the following exception:
>
> java.lang.IllegalArgumentException: Size of array must be smaller than Integer.MAX_VALUE.
> at javax.media.jai.RasterFactory.createBandedRaster(RasterFactory.java:307)
> ....
>
> So I see this is not a valid option to create big images... Is there another option to create a big Raster or Image object with JAI?
>
> Thanks in advance,
>
> César
> [Message sent by forum member 'dispiste' (cesar.izq@gmail.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=369971
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net