[geotk] [geotk[ Write GeoTIFF
Martin Desruisseaux
martin.desruisseaux at geomatys.fr
Fri Apr 22 09:20:20 EDT 2011
Hello Ramzi
The GeoTIFF plugin is still in the "pending" section of Geotk, which probably
make it harder to find from the documentation.
In theory, the following convenience method would work (available only on
snapshots for now, until Geotk 3.18 is released):
http://www.geotoolkit.org/apidocs/org/geotoolkit/coverage/io/CoverageIO.html#write%28org.opengis.coverage.grid.GridCoverage,%20java.lang.String,%20java.lang.Object%29
You can also use the ImageCoverageWriter class directly if you wish more control.
It should works for the "TIFF" format, in which case "tfw" and "prj" files are
generated together with the tiff image (same for "PNG" or "JPG"). For GeoTiff,
we would need to ensure that the geotk-coverageio-geotiff jar file is on the
classpath
(http://maven.geotoolkit.org/org/geotoolkit/pending/geotk-coverageio-geotiff/).
But this have not been tested recently.
If you wish to perform more steps manually, in order to create a SpatialMetadata
from a CRS, the
http://www.geotoolkit.org/apidocs/org/geotoolkit/image/io/metadata/ReferencingBuilder.html
class can be of some help (but perform only part of the work). I would suggest
to use ImageCoverageWriter instead. You can create a GridCoverage from a
RenderedImage, a CRS and an Envelope using the following method:
http://www.geotoolkit.org/apidocs/org/geotoolkit/coverage/grid/GridCoverageFactory.html#create%28java.lang.CharSequence,%20java.awt.image.RenderedImage,%20org.opengis.geometry.Envelope%29
Hope it help,
Martin
Le 22/04/11 13:50, Ramzi Oueslati a écrit :
> Hello list,
>
> Is there any way to write a geotiff file from a RenderedImage, an
> Envelope and a CRS ?
> I tried really hard to figure it out through the documentation, the
> list and the demos sample code. I think I'm stuck with the
> SpatialMetadata I'm not able to create out of the CRS+Envelope.
>
> Best regards,
> Ramzi Oueslati
More information about the Geotoolkit
mailing list