Class RasterImageIO

java.lang.Object
org.openjump.core.rasterimage.RasterImageIO

public class RasterImageIO extends Object
Author:
deluca
  • 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

      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 name
      alwaysLookForTFWExtension - 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 file
      raster - a Raster
      envelope - Envelope of the image to write
      cellSizeX - cell width in model coordinates
      cellSizeY - cell height in model coordinates
      noData - value to use for nodata
      srsInfo - SRSInfo associated to this Raster
      Throws:
      IOException - if an IOException occurs
      TransformerConfigurationException - if a TransformerConfigurationException occurs
      ParserConfigurationException - if a ParserConfigurationException occurs
      TransformerException - if a TransformerException occurs
      SAXException - if a SAXException occurs
    • calcRequestedResolution

      public static Resolution calcRequestedResolution(Viewport viewport)