Package org.openjump.core.rasterimage
Class RasterImageIOUtils
- java.lang.Object
-
- org.openjump.core.rasterimage.RasterImageIOUtils
-
public class RasterImageIOUtils extends Object
- Version:
- 1 [2015-03-11]
- Author:
- Giuseppe Aruta - Extension codes to perform some RasterImage Input/Output operations
-
-
Field Summary
Fields Modifier and Type Field Description static doubledefaultNoData
-
Constructor Summary
Constructors Constructor Description RasterImageIOUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidload(File file, PlugInContext context, String category)Load TIF/ASC/FLT file into OpenJUMP workbenchstatic voidloadASC(File file, PlugInContext context, String category)Load ArcView Gridded Ascii (ASC) file into OpenJUMP workbenchstatic voidloadFLT(File file, PlugInContext context, String category)Load Arcview Gridded Binary file (HDR/FLT) into OpenJUMP workbenchstatic voidloadTIF(File file, PlugInContext context, String category)Load TIF file into OpenJUMP workbenchstatic voidsaveASC(File outfile, PlugInContext context, RasterImageLayer rLayer)Export selected monoband raster to ArcView Gridded Ascii (ASC)static voidsaveASC(File file, PlugInContext context, RasterImageLayer rLayer, int band)Export selected raster to ArcView Gridded Ascii (ASC)static voidsaveFLT(File outfile, PlugInContext context, RasterImageLayer rLayer)Export selected monoband raster to ArcView Gridded Binary data (FLT)static voidsaveFLT(File outFile, PlugInContext context, RasterImageLayer rLayer, int band)Export selected raster to ArcView Gridded Binary data (FLT)static voidsaveFLT_extract(File outFile, PlugInContext context, RasterImageLayer rLayer, int band, float mindata, float maxdata, float nodata)Extract a selected range of values of a raster.static voidsaveFLT_mask(File outFile, PlugInContext context, RasterImageLayer rLayer, int band, float mindata, float maxdata, float nodata)Mask a selected range of values of a raster.static voidsaveGrass(File file, PlugInContext context, RasterImageLayer rLayer, int band)Test.static voidsaveHDR(File outFile, PlugInContext context, RasterImageLayer rLayer)Export selected raster to ArcView Gridded Binary header (HDR)static voidsaveImage(File file, String format, BufferedImage bufferedimage, org.locationtech.jts.geom.Envelope envelope)Export selected raster to various image file formats using ImageIOstatic voidsaveSurferGRD(File outfile, PlugInContext context, RasterImageLayer rLayer)Export selected monoband raster to Surfer ASCII Grid (GRD)static voidsaveSurferGRD(File outfile, PlugInContext context, RasterImageLayer rLayer, int band)Export selected raster to Surfer ASCII Grid (GRD)static voidsaveTIF(File file, RasterImageLayer rLayer, org.locationtech.jts.geom.Envelope envWanted)Export selected raster to TIF/TFW - using JAI TiffEncoder.classstatic voidsaveTIF(File file, RasterImageLayer rLayer, org.locationtech.jts.geom.Envelope envWanted, int band)static voidsaveTIF_ImageIO(File file, org.locationtech.jts.geom.Envelope envelope, javax.media.jai.PlanarImage planarimage)Export selected raster to TIF/TFW - using ImageIO.classstatic voidsaveXYZ(File outfile, PlugInContext context, RasterImageLayer rLayer)Export selected raster to XYZ table.
-
-
-
Method Detail
-
saveTIF
public static void saveTIF(File file, RasterImageLayer rLayer, org.locationtech.jts.geom.Envelope envWanted) throws IOException
Export selected raster to TIF/TFW - using JAI TiffEncoder.class- Parameters:
file- file to save es D:/Openjump/test.tifrLayer- Selected Raster Image Layer (RasterImageLayer.class)envWanted- envelope wanted- Throws:
IOException- if an IOException occurs in RasterImageLayer.getRasterData or in RasterImageIO.writeImage
-
saveTIF
public static void saveTIF(File file, RasterImageLayer rLayer, org.locationtech.jts.geom.Envelope envWanted, int band) throws NoninvertibleTransformException, TiffTags.TiffReadingException, Exception
-
saveImage
public static void saveImage(File file, String format, BufferedImage bufferedimage, org.locationtech.jts.geom.Envelope envelope) throws IOException
Export selected raster to various image file formats using ImageIO- Parameters:
file- destination file (absolute or relative path)format- Image I/O built-in support for both Oracle Java and OpenJDK is "gif", "png" and "tif". Oracle Java support also "jpg". Other formats might be work depending on installed codecsbufferedimage- BufferedImageenvelope- Envelope- Throws:
IOException- if an IOException occurs
-
saveTIF_ImageIO
public static void saveTIF_ImageIO(File file, org.locationtech.jts.geom.Envelope envelope, javax.media.jai.PlanarImage planarimage) throws IOException
Export selected raster to TIF/TFW - using ImageIO.class- Parameters:
file- file to save es D:/Openjump/test.tifenvelope- envelope of selected Image Layer (RasterImageLayer.class)planarimage- PlanarImage of selected Image Layer (RasterImageLayer.class)- Throws:
IOException- if an IOException occurs
-
saveASC
public static void saveASC(File outfile, PlugInContext context, RasterImageLayer rLayer) throws IOException
Export selected monoband raster to ArcView Gridded Ascii (ASC)- Parameters:
outfile- file to save es D:/Openjump/test.asccontext- Plugin ContextrLayer- Selected Raster Image Layer (RasterImageLayer.class)- Throws:
IOException- if an IOException occurs
-
saveASC
public static void saveASC(File file, PlugInContext context, RasterImageLayer rLayer, int band) throws IOException
Export selected raster to ArcView Gridded Ascii (ASC)- Parameters:
file- file to save es D:/Openjump/test.asccontext- Plugin ContextrLayer- Selected Raster Image Layer (RasterImageLayer.class)band- Number of band to save (O=red, 1=green, 2=blue)- Throws:
IOException- if an IOException occurs
-
saveHDR
public static void saveHDR(File outFile, PlugInContext context, RasterImageLayer rLayer) throws IOException
Export selected raster to ArcView Gridded Binary header (HDR)- Parameters:
outFile- file to save es D:/Openjump/test.hdrcontext- . Plugin ContextrLayer- . Selected Raster Image Layer (RasterImageLayer.class)- Throws:
IOException- if an IOException occurs
-
saveFLT
public static void saveFLT(File outfile, PlugInContext context, RasterImageLayer rLayer) throws IOException
Export selected monoband raster to ArcView Gridded Binary data (FLT)- Parameters:
outfile- file to save es D:/Openjump/test.fltcontext- Plugin ContextrLayer- Selected Raster Image Layer (RasterImageLayer.class)- Throws:
IOException- if an IOException occurs
-
saveFLT
public static void saveFLT(File outFile, PlugInContext context, RasterImageLayer rLayer, int band) throws IOException
Export selected raster to ArcView Gridded Binary data (FLT)- Parameters:
outFile- file to save es D:/Openjump/test.fltcontext- Plugin ContextrLayer- Selected Raster Image Layer (RasterImageLayer.class)band- Number of the band to save (O=1st band (red), 1=2nd band (green), 2=3rd band (blue), etc)- Throws:
IOException- if an IOException occurs
-
saveSurferGRD
public static void saveSurferGRD(File outfile, PlugInContext context, RasterImageLayer rLayer) throws IOException
Export selected monoband raster to Surfer ASCII Grid (GRD)- Parameters:
outfile- file to save es D:/Openjump/test.grdcontext- Plugin ContextrLayer- Selected Raster Image Layer (RasterImageLayer.class)- Throws:
IOException- if an IOException occurs
-
saveSurferGRD
public static void saveSurferGRD(File outfile, PlugInContext context, RasterImageLayer rLayer, int band) throws IOException
Export selected raster to Surfer ASCII Grid (GRD)- Parameters:
outfile- file to save es D:/Openjump/test.grdcontext- . Plugin ContextrLayer- . Selected Raster Image Layer (RasterImageLayer.class)band- . Number of band to save (O=1st band (red), 1=2nd band (green), 2=3rd band (blue), etc)- Throws:
IOException- if an IOException occurs
-
saveXYZ
public static void saveXYZ(File outfile, PlugInContext context, RasterImageLayer rLayer) throws IOException
Export selected raster to XYZ table. If the file is a multi banded raster each band is extracted to a proper band named "band1", "band2", etc- Parameters:
outfile- file to save es D:/Openjump/test.xyzcontext- . Plugin ContextrLayer- . Selected Raster Image Layer (RasterImageLayer.class)- Throws:
IOException- if an IOException occurs
-
saveGrass
public static void saveGrass(File file, PlugInContext context, RasterImageLayer rLayer, int band) throws IOException
Test. Export selected raster to GRASS file.- Parameters:
file- file to save es D:/Openjump/testcontext- . Plugin ContextrLayer- . Selected Raster Image Layer (RasterImageLayer.class)- Throws:
IOException- if an IOException occurs
-
load
public static void load(File file, PlugInContext context, String category) throws NoninvertibleTransformException, TiffTags.TiffReadingException, Exception
Load TIF/ASC/FLT file into OpenJUMP workbench- Parameters:
file- file to load es D:/Openjump/test.tifcontext- Plugin Contextcategory- Name of the category to load the file- Throws:
NoninvertibleTransformException- , TiffReadingException, ExceptionTiffTags.TiffReadingExceptionException
-
loadTIF
public static void loadTIF(File file, PlugInContext context, String category) throws Exception
Load TIF file into OpenJUMP workbench- Parameters:
file- file to load es D:/Openjump/test.tifcontext- Plugin Contextcategory- Name of the category to load the file- Throws:
NoninvertibleTransformException- , TiffReadingException, ExceptionException
-
loadFLT
public static void loadFLT(File file, PlugInContext context, String category) throws NoninvertibleTransformException, TiffTags.TiffReadingException, Exception
Load Arcview Gridded Binary file (HDR/FLT) into OpenJUMP workbench- Parameters:
file- file to loadcontext- PlugInContextcategory- Name of the category to load the file- Throws:
NoninvertibleTransformException- , TiffReadingException, ExceptionTiffTags.TiffReadingExceptionException
-
loadASC
public static void loadASC(File file, PlugInContext context, String category) throws Exception
Load ArcView Gridded Ascii (ASC) file into OpenJUMP workbench- Parameters:
file- file to loadcontext- the PlugInContextcategory- name of the category to load the file- Throws:
Exception- if an Exception occurs
-
saveFLT_mask
public static void saveFLT_mask(File outFile, PlugInContext context, RasterImageLayer rLayer, int band, float mindata, float maxdata, float nodata) throws IOException
Mask a selected range of values of a raster. The range will be defined by a lower and upper values of the range. The values within the range will be substituted by nodata value. The output file is a Arcview Gridded Binary file (HDR/FLT)- Parameters:
outFile- file to save es D:/Openjump/test.fltcontext- Plugin ContextrLayer- Selected Raster Image Layer (RasterImageLayer.class)band- band Number of the band to save (O=1st band (red), 1=2nd band (green), 2=3rd band (blue), etc)mindata- lower value of the mask rangemaxdata- upper value of the mask rangenodata- nodata value- Throws:
IOException
-
saveFLT_extract
public static void saveFLT_extract(File outFile, PlugInContext context, RasterImageLayer rLayer, int band, float mindata, float maxdata, float nodata) throws IOException
Extract a selected range of values of a raster. The range will be defined by a lower and upper values of the range. All the raster cell values outside this range of values will be substituted by nodata value.The output file is a Arcview Gridded Binary file (HDR/FLT)- Parameters:
outFile- file to save es D:/Openjump/test.fltcontext- Plugin ContextrLayer- Selected Raster Image Layer (RasterImageLayer.class)band- band Number of the band to save (O=1st band (red), 1=2nd band (green), 2=3rd band (blue), etc)mindata- lower value of the extract rangemaxdata- upper value of the e rangenodata- nodata value- Throws:
IOException
-
-