Class RasterImageLayerProperties


  • public class RasterImageLayerProperties
    extends Object
    • Constructor Detail

      • RasterImageLayerProperties

        public RasterImageLayerProperties()
    • Method Detail

      • getFileSizeMegaBytes

        public static String getFileSizeMegaBytes​(long bytes)
        Converts bytes to multiple (Kilo, Mega, Giga-bytes according to the dimension of the file. Return as String
        Parameters:
        bytes - as long
        Returns:
        java.lang.String
      • getFileSizeBytes

        public static long getFileSizeBytes​(RasterImageLayer layer)
        Gets dimension of RasterImageLayer in long
        Parameters:
        layer - a RasterImageLayer
        Returns:
        the size of the file containing the image
      • getFileExtension

        public static String getFileExtension​(RasterImageLayer layer)
        Return the extension of the file as String
        Parameters:
        layer - a RasterImageLayer
        Returns:
        the file extension as String
      • numBands

        public static String numBands​(RasterImageLayer layer)
        Gets the number of bands from A RasterImageLayer as String
        Parameters:
        layer - a RasterImageLayer
        Returns:
        the number of bands as a String
      • getDataType

        public static String getDataType​(Raster raster)
                                  throws IOException
        Gets data type as String
        Parameters:
        raster - a java.awt.image.Raster
        Returns:
        the data type as a String
        Throws:
        IOException - never
      • getColorDepth

        public static String getColorDepth​(Raster raster,
                                           File file)
                                    throws IOException,
                                           org.apache.commons.imaging.ImageReadException
        Gets color depth as String It first check into the Raster otherwise uses first Commons Imaging then ImageIO to check into the file
        Parameters:
        raster - a java.awt.image.Raster
        file - the File containing the image
        Returns:
        the color depth as a String
        Throws:
        IOException - if an IOException occurs during file I/O
        org.apache.commons.imaging.ImageReadException - if an Exception occurs during image reading
      • getDPI

        public static String getDPI​(Raster raster,
                                    File file)
                             throws IOException,
                                    org.apache.commons.imaging.ImageReadException
        Gets BPP (bits per pixel), first check into the raster then into the file using Commons Imaging
        Parameters:
        raster - the java.awt.image.Raster
        file - the File containing the image
        Returns:
        the number of bits per pixel as a String
        Throws:
        IOException - if an IOException occurs during file I/O
        org.apache.commons.imaging.ImageReadException - if an Exception occurs during image reading
      • cellSizeX

        public static double cellSizeX​(Raster raster,
                                       org.locationtech.jts.geom.Envelope env)
                                throws IOException
        Gets the cell size along X as Double
        Parameters:
        raster - the java.awt.image.Raster
        env - image Envelope
        Returns:
        pixel width as a double
        Throws:
        IOException - never
      • cellSizeY

        public static double cellSizeY​(Raster raster,
                                       org.locationtech.jts.geom.Envelope env)
                                throws IOException
        Gets the cell size along Y as double
        Parameters:
        raster - the java.awt.image.Raster
        env - the Envelope
        Returns:
        pixel height as a double
        Throws:
        IOException - never
      • getNumColumns

        public static int getNumColumns​(Raster raster)
                                 throws IOException
        Gets the number of column in a Raster as int
        Parameters:
        raster - the java.awt.image.Raster
        Returns:
        the number of columns
        Throws:
        IOException - never
      • getNumRows

        public static int getNumRows​(Raster raster)
                              throws IOException
        Gets number of rows as int
        Parameters:
        raster - the java.awt.image.Raster
        Returns:
        the number of rows
        Throws:
        IOException - never