Class RasterImageIO
java.lang.Object
org.openjump.core.rasterimage.RasterImageIO
- Author:
- deluca
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 Doublestatic 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) loadImage(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)
-
Constructor Details
-
RasterImageIO
public RasterImageIO()
-
-
Method Details
-
loadImage
public ImageAndMetadata loadImage(String fileNameOrURL, Stats stats, org.locationtech.jts.geom.Envelope viewPortEnvelope, Resolution requestedRes) throws Exception - Throws:
Exception
-
loadRasterData
- Throws:
IOException
-
readCellValue
-
readCellValue
public static Double readCellValue(String filenameOrURL, int col, int row, int band) throws IOException - Throws:
IOException
-
getImageDimensions
- 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
- Throws:
Exception
-
getNoData
- 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
-