Package org.esa.snap.core.util.geotiff
Class GeoTIFF
- java.lang.Object
-
- org.esa.snap.core.util.geotiff.GeoTIFF
-
public class GeoTIFF extends Object
-
-
Constructor Summary
Constructors Constructor Description GeoTIFF()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static IIOImage
createIIOImage(ImageWriter writer, RenderedImage im, GeoTIFFMetadata geoTIFFMetadata)
Creates IIO image instance given image and GeoTIFF metadata.static IIOMetadata
createIIOMetadata(ImageWriter writer, ImageTypeSpecifier type, GeoTIFFMetadata geoTIFFMetadata)
Creates image metadata which complies to the GeoTIFF specification for the given image writer, image type and GeoTIFF metadata.static IIOMetadata
createIIOMetadata(ImageWriter writer, ImageTypeSpecifier type, GeoTIFFMetadata geoTIFFMetadata, String metadataFormatName, String classNameList)
Creates image metadata which complies to the GeoTIFF specification for the given image writer, image type and GeoTIFF metadata.static ImageWriter
getImageWriter(RenderedImage image)
Gets an image writer suitable to be used for GeoTIFF.static ImageWriter
getImageWriter(ImageTypeSpecifier imageType)
Gets an image writer suitable to be used for GeoTIFF.static boolean
writeImage(RenderedImage image, File outputFile, GeoTIFFMetadata geoTIFFMetadata)
Writes an image using an arbitraryImageWriter
that supports the GeoTIFF format to aFile
.static boolean
writeImage(RenderedImage image, ImageOutputStream outputStream, GeoTIFFMetadata geoTIFFMetadata)
Writes an image using an arbitraryImageWriter
that supports the GeoTIFF format to anImageOutputStream
.
-
-
-
Method Detail
-
writeImage
public static boolean writeImage(RenderedImage image, File outputFile, GeoTIFFMetadata geoTIFFMetadata) throws IOException
Writes an image using an arbitraryImageWriter
that supports the GeoTIFF format to aFile
. If there is already aFile
present, its contents are discarded.- Parameters:
image
- aRenderedImage
to be written. name of the format.outputFile
- aFile
to be written to.geoTIFFMetadata
- the GeoTIFF specific metadata- Returns:
false
if no appropriate image I/O writer was found.- Throws:
IllegalArgumentException
- if any parameter isnull
.IOException
- if an error occurs during writing.
-
writeImage
public static boolean writeImage(RenderedImage image, ImageOutputStream outputStream, GeoTIFFMetadata geoTIFFMetadata) throws IOException
Writes an image using an arbitraryImageWriter
that supports the GeoTIFF format to anImageOutputStream
. The image is written to theImageOutputStream
starting at the current stream pointer, overwriting existing stream data from that point forward, if present.- Parameters:
image
- aRenderedImage
to be written.outputStream
- anImageOutputStream
to be written to.geoTIFFMetadata
- the GeoTIFF specific metadata- Returns:
false
if no appropriate writer is found.- Throws:
IllegalArgumentException
- if any parameter isnull
.IOException
- if an error occurs during writing.
-
getImageWriter
public static ImageWriter getImageWriter(RenderedImage image)
Gets an image writer suitable to be used for GeoTIFF.- Parameters:
image
- the image to be written later- Returns:
- a suitable image writer, or
null
if no writer is found
-
getImageWriter
public static ImageWriter getImageWriter(ImageTypeSpecifier imageType)
Gets an image writer suitable to be used for GeoTIFF.- Parameters:
imageType
- the type of the image to be written later- Returns:
- a suitable image writer, or
null
if no writer is found
-
createIIOImage
public static IIOImage createIIOImage(ImageWriter writer, RenderedImage im, GeoTIFFMetadata geoTIFFMetadata) throws IIOException
Creates IIO image instance given image and GeoTIFF metadata.- Parameters:
writer
- the image writer, must not be nullim
- the image, must not be nullgeoTIFFMetadata
- the GeoTIFF metadata, must not be null- Returns:
- the IIO image, never null
- Throws:
IIOException
- if the metadata cannot be created
-
createIIOMetadata
public static IIOMetadata createIIOMetadata(ImageWriter writer, ImageTypeSpecifier type, GeoTIFFMetadata geoTIFFMetadata) throws IIOException
Creates image metadata which complies to the GeoTIFF specification for the given image writer, image type and GeoTIFF metadata.- Parameters:
writer
- the image writer, must not be nulltype
- the image type, must not be nullgeoTIFFMetadata
- the GeoTIFF metadata, must not be null- Returns:
- the image metadata, never null
- Throws:
IIOException
- if the metadata cannot be created
-
createIIOMetadata
public static IIOMetadata createIIOMetadata(ImageWriter writer, ImageTypeSpecifier type, GeoTIFFMetadata geoTIFFMetadata, String metadataFormatName, String classNameList) throws IIOException
Creates image metadata which complies to the GeoTIFF specification for the given image writer, image type and GeoTIFF metadata.- Parameters:
writer
- the image writer, must not be nulltype
- the image type, must not be nullgeoTIFFMetadata
- the GeoTIFF metadata, must not be nullmetadataFormatName
- the name of the Metadata Format specificationclassNameList
- comma separated list of Metadata classes- Returns:
- the image metadata, never null
- Throws:
IIOException
- if the metadata cannot be created
-
-