Package org.openjump.core.rasterimage
Class RasterImageIO
- java.lang.Object
-
- org.openjump.core.rasterimage.RasterImageIO
-
public class RasterImageIO extends Object
- Author:
- deluca
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classRasterImageIO.CellSizeXY
-
Constructor Summary
Constructors Constructor Description RasterImageIO()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ResolutioncalcRequestedResolution(Viewport viewport)static org.locationtech.jts.geom.CoordinatefromCellToCoordinate(Point cell, org.locationtech.jts.geom.Coordinate lowerLeftCoord, double cellSize, int rowCount)static PointfromCoordinateToCell(org.locationtech.jts.geom.Coordinate coord, org.locationtech.jts.geom.Coordinate lowerLeftCoord, int rowCount, double cellSizeX, double cellSizeY)static RasterImageIO.CellSizeXYgetCellSize(String fileNameOrURL)static RectanglegetDrawingRectangle(int imgWidth, int imgHeight, org.locationtech.jts.geom.Envelope wholeImageEnvelope, org.locationtech.jts.geom.Envelope viewportEnvelope, Resolution subsetResolution)static org.locationtech.jts.geom.EnvelopegetGeoReferencing(String fileName, boolean alwaysLookForTFWExtension, Point imageDimensions)Substituted by method getGeoReferencing(String fileName)static PointgetImageDimensions(String filenameOrURL)static DoublegetNoData(String fileNameOrURL)static org.locationtech.jts.geom.EnvelopegetViewingEnvelope(Viewport viewport)protected RectanglegetVisibleImageCoordinatesOfImage(double imgWidth, double imgHeight, org.locationtech.jts.geom.Envelope visible, org.locationtech.jts.geom.Envelope imageEnv)ImageAndMetadataloadImage(String fileNameOrURL, Stats stats, org.locationtech.jts.geom.Envelope viewPortEnvelope, Resolution requestedRes)static RasterloadRasterData(String filenameOrURL, Rectangle subset)static DoublereadCellValue(String filenameOrURL, int col, int row, int band)static DoublereadCellValue(String fileNameOrURL, org.locationtech.jts.geom.Coordinate coordinate, int band)voidwriteImage(File outFile, Raster raster, org.locationtech.jts.geom.Envelope envelope, double cellSizeX, double cellSizeY, double noData, SRSInfo srsInfo)Enhanced method to save the TIF with an external TIF.AUX.XML file which contains statistics of raster and spatial reference system.voidwriteImage(File outFile, Raster raster, org.locationtech.jts.geom.Envelope envelope, RasterImageIO.CellSizeXY cellSize, double noData)
-
-
-
Method Detail
-
loadImage
public ImageAndMetadata loadImage(String fileNameOrURL, Stats stats, org.locationtech.jts.geom.Envelope viewPortEnvelope, Resolution requestedRes) throws Exception
- Throws:
Exception
-
loadRasterData
public static Raster loadRasterData(String filenameOrURL, Rectangle subset) throws IOException
- Throws:
IOException
-
readCellValue
public static Double readCellValue(String fileNameOrURL, org.locationtech.jts.geom.Coordinate coordinate, int band) throws Exception
- Throws:
Exception
-
readCellValue
public static Double readCellValue(String filenameOrURL, int col, int row, int band) throws IOException
- Throws:
IOException
-
getImageDimensions
public static Point getImageDimensions(String filenameOrURL) throws IOException
- Throws:
IOException
-
getGeoReferencing
public static org.locationtech.jts.geom.Envelope getGeoReferencing(String fileName, boolean alwaysLookForTFWExtension, Point imageDimensions) throws Exception
Substituted by method getGeoReferencing(String fileName)- Parameters:
fileName- file namealwaysLookForTFWExtension- whether the method should read georeferencing in an associated world file (tfw)imageDimensions-- Returns:
- Envelope envelope of the image in model coordinates
- Throws:
Exception- if an Exception occurs
-
getCellSize
public static RasterImageIO.CellSizeXY getCellSize(String fileNameOrURL) throws Exception
- Throws:
Exception
-
getNoData
public static Double getNoData(String fileNameOrURL) throws IOException
- Throws:
IOException
-
getViewingEnvelope
public static org.locationtech.jts.geom.Envelope getViewingEnvelope(Viewport viewport) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
getDrawingRectangle
public static Rectangle getDrawingRectangle(int imgWidth, int imgHeight, org.locationtech.jts.geom.Envelope wholeImageEnvelope, org.locationtech.jts.geom.Envelope viewportEnvelope, Resolution subsetResolution) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
getVisibleImageCoordinatesOfImage
protected Rectangle getVisibleImageCoordinatesOfImage(double imgWidth, double imgHeight, org.locationtech.jts.geom.Envelope visible, org.locationtech.jts.geom.Envelope imageEnv)
-
fromCoordinateToCell
public static Point fromCoordinateToCell(org.locationtech.jts.geom.Coordinate coord, org.locationtech.jts.geom.Coordinate lowerLeftCoord, int rowCount, double cellSizeX, double cellSizeY)
-
fromCellToCoordinate
public static org.locationtech.jts.geom.Coordinate fromCellToCoordinate(Point cell, org.locationtech.jts.geom.Coordinate lowerLeftCoord, double cellSize, int rowCount)
-
writeImage
public void writeImage(File outFile, Raster raster, org.locationtech.jts.geom.Envelope envelope, RasterImageIO.CellSizeXY cellSize, double noData) throws IOException
- Throws:
IOException
-
writeImage
public void writeImage(File outFile, Raster raster, org.locationtech.jts.geom.Envelope envelope, double cellSizeX, double cellSizeY, double noData, SRSInfo srsInfo) throws IOException, TransformerConfigurationException, ParserConfigurationException, TransformerException, SAXException
Enhanced method to save the TIF with an external TIF.AUX.XML file which contains statistics of raster and spatial reference system. Worldfile is not saved as geographic position is already stored into the TIF file. Statistics are calculated from raster- Parameters:
outFile- output fileraster- a Rasterenvelope- Envelope of the image to writecellSizeX- cell width in model coordinatescellSizeY- cell height in model coordinatesnoData- value to use for nodatasrsInfo- SRSInfo associated to this Raster- Throws:
IOException- if an IOException occursTransformerConfigurationException- if a TransformerConfigurationException occursParserConfigurationException- if a ParserConfigurationException occursTransformerException- if a TransformerException occursSAXException- if a SAXException occurs
-
calcRequestedResolution
public static Resolution calcRequestedResolution(Viewport viewport)
-
-