[geotk] Trouble reading GMT grid file

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Fri Nov 4 07:19:10 EDT 2011


Le 03/11/11 23:40, Brian Schlining a écrit :
> That someone would be me. I was helping John get some maven issues sorted out; 
> then I put it in a repo at http://code.google.com/p/mbari-maven-repository/ 
> when it was first released. 

There is also an Italian university (forgot the exact URL) who deployed NetCDF 
artifacts. Having NetCDF releases systematically deployed on Maven Central would 
be nice for avoiding confusion...

> Assuming I get it read in, my next question is how to I create a 1200x1200 image of a map from the GridCoverage with the Geotk libraries? ) I don't need to display it, I'm just going to write it to disk.

The easiest way is (note: RenderedImage and RenderableImage are JDK interfaces):

   RenderedImage image = coverage.getRenderableImage(0,1).createScaledRendering(1200, 1200, null);


Alternatively, Geotk provides also a "Resample" operation providing more control 
(interpolation method, background color, map reprojection...). I can post an 
other email if you wish to go along that path.

References:

     
http://www.geotoolkit.org/apidocs/org/geotoolkit/coverage/grid/GridCoverage2D.html#getRenderableImage%28int,%20int%29
     
http://www.geotoolkit.org/apidocs/org/geotoolkit/coverage/processing/operation/Resample.html


         Martin



More information about the Geotoolkit mailing list