Hi,

As a newbie to GIS, i'm looking for information on how to use GeoTools (or any 
appropriate) APIs to convert a double[][] into a PNG.

According to the manual technique using AWT i was trying (below), it seems i 
need a raster then saving it as a PNG but i'm hoping there's a more 
straightforward way using GeoTools APIs (and APIS that actually work for me :)

BTW, as i understand it, i'm generating tiles to be served (layered?) by 
GeoServer. If there's a better method/format, i'm open to that.

Thanks for any pointers you can provide,
Robert


      DataBufferDouble db = new DataBufferDouble(d, d[0].length);
      SampleModel sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_DOUBLE,
        w, h, 4, w * 4, new int[]{2, 1, 0, 3});
      ColorModel cm = new ComponentColorModel(ColorSpace.getInstance(
        ColorSpace.CS_LINEAR_RGB), true, true, ColorModel.TRANSLUCENT,
        DataBuffer.TYPE_DOUBLE);
      WritableRaster wr = WritableRaster.createWritableRaster(sm, db, null);
      BufferedImage bi = new BufferedImage(cm, wr, true, new Hashtable<>());
      File outputfile = new File("saved.png");
      ImageIO.write(bi, "png", outputfile);

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to