[visad] another offscreen question

I having been using visad to produce png images.  My current approach is this:

1 given a map projection P and a pair of lat,lons (representing the corners of some region of interest), produce a rectangle, call in W, where W's dimensions are in km.
2 set W as the defaultMapArea of P.  This results in W mapping to the visad 'box', which is in the visad coordinate space, and 
extends from -1 to 1 in x and y.  This is an affine transform, call it A1.
3 For some given scale S of pixels per km, create an offscreen DisplayImpl of size W.width * S, W.height * S.  thus we have a 
buffered image B of this size.
4 Adjust the projection matrix such that the visad box maps exactly to B, so e.g. -1,-1 -> 0, B.height.  Call this 
affineTransform A2.
5 Add some lat,lon data, say a bathy dataset, and let visad produce B

6 Given B, I then cut it up into non-overlapping tiles of say 256 pixels square. This last step is not a visad operation, just a BufferedImage.subImage op.
I need transparent images, so I have altered VisadCanvasJ2D to build buffered images of type INT_RGBA (which I suspect costs me 
4 bytes per pixel)
I am running into memory issues.   Looking at VisadCanvasJ2D, there are 3 bufferedimages in memory at once when deriving the 
'captured' image: images[0], aux_image and captureImage.  The memory requirement for the app is thus:
W.width * S * W.height * S * 4 * 3

which for a 750km square W and S = 8 is 432MB.

As W gets larger, or we want larger S ( more 'zoomed in' levels ), my app is 
dying.

So my question (finally) is can I organize the app in any other way? Can I just build B so that it is the same size as a tile. If I then change A1 over and over, aligning A1 to map to each tile, am I paying the cost of re-transforming all the input data every time? I guess so. Or can I just change A2, saving on data transformations? Is it a requirement that B is the 'full size' image or can B just be the size of a tile??
Or I could just add more RAM and not try to solve this issue at all...


Any help appreciated

Stuart



  • 2008 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: