Class GdalBand
java.lang.Object
com.eco.bio7.gdal.GdalBand
A band of a raster dataset: its pixels as Java arrays (row by row, the first
row is the top), the no data value, the color table and the statistics.
GDAL converts the pixels to the type of the array.
-
Method Summary
Modifier and TypeMethodDescriptionThe color interpretation (e.g., "Gray", "Red", "Palette", "Alpha").int[]The color table as ARGB values (index -> color), null if the band has none.voidcontours(VectorLayer target, double interval, String... options) Contour lines of the band into a vector layer (gdal_contour): the fields "ID" and "ELEV" are created if they don't exist; the no data value of the band is used.dataType()intheight()intindex()double[]minMax(boolean approximate) {min, max} of the values (without the no data value; approximate: faster for large rasters).noData()The value of the pixels without data (null if not set).doubleoffset()The offset of the values (value = raw * scale + offset), 0 if not set.voidpolygonize(VectorLayer target, String field, boolean useMask, String... options) Polygons of the areas of equal values (gdal_polygonize) into a vector layer: the value of each polygon in the field (created if it doesn't exist: integer, or real for float bands).byte[]The pixels as 8 bit values (unsigned: invalid input: '&' 0xff).byte[]readBytes(int x, int y, int w, int h) double[]double[]readDoubles(int x, int y, int w, int h) The pixels of a window as double values (row by row).float[]float[]readFloats(int x, int y, int w, int h) float[]readFloats(int x, int y, int w, int h, int bufferWidth, int bufferHeight) The pixels of a window resampled to the size of the buffer (e.g., an overview of a large raster: GDAL uses the overviews of the file).int[]readInts()int[]readInts(int x, int y, int w, int h) short[]The pixels as 16 bit values (UInt16 or Int16 rasters; unsigned: invalid input: '&' 0xffff).short[]readShorts(int x, int y, int w, int h) doublescale()The scale of the values (value = raw * scale + offset), 1 if not set.voidsetNoData(double value) toString()intwidth()voidwrite(byte[] values) Writes 8 bit values (unsigned).voidwrite(double[] values) voidwrite(float[] values) voidwrite(int[] values) voidwrite(int x, int y, int w, int h, byte[] values) voidwrite(int x, int y, int w, int h, double[] values) voidwrite(int x, int y, int w, int h, float[] values) voidwrite(int x, int y, int w, int h, int[] values) voidwrite(int x, int y, int w, int h, short[] values) voidwrite(short[] values) Writes 16 bit values (as UInt16, or Int16 for an Int16 band).
-
Method Details
-
index
public int index() -
width
public int width() -
height
public int height() -
dataType
-
noData
The value of the pixels without data (null if not set). -
setNoData
public void setNoData(double value) -
colorInterpretation
The color interpretation (e.g., "Gray", "Red", "Palette", "Alpha"). -
colorTable
public int[] colorTable()The color table as ARGB values (index -> color), null if the band has none. -
scale
public double scale()The scale of the values (value = raw * scale + offset), 1 if not set. -
offset
public double offset()The offset of the values (value = raw * scale + offset), 0 if not set. -
minMax
public double[] minMax(boolean approximate) {min, max} of the values (without the no data value; approximate: faster for large rasters). -
readDoubles
public double[] readDoubles() -
readDoubles
public double[] readDoubles(int x, int y, int w, int h) The pixels of a window as double values (row by row). -
readFloats
public float[] readFloats() -
readFloats
public float[] readFloats(int x, int y, int w, int h) -
readInts
public int[] readInts() -
readInts
public int[] readInts(int x, int y, int w, int h) -
readShorts
public short[] readShorts()The pixels as 16 bit values (UInt16 or Int16 rasters; unsigned: invalid input: '&' 0xffff). -
readShorts
public short[] readShorts(int x, int y, int w, int h) -
readBytes
public byte[] readBytes()The pixels as 8 bit values (unsigned: invalid input: '&' 0xff). -
readBytes
public byte[] readBytes(int x, int y, int w, int h) -
readFloats
public float[] readFloats(int x, int y, int w, int h, int bufferWidth, int bufferHeight) The pixels of a window resampled to the size of the buffer (e.g., an overview of a large raster: GDAL uses the overviews of the file). -
write
public void write(double[] values) -
write
public void write(int x, int y, int w, int h, double[] values) -
write
public void write(float[] values) -
write
public void write(int x, int y, int w, int h, float[] values) -
write
public void write(int[] values) -
write
public void write(int x, int y, int w, int h, int[] values) -
write
public void write(short[] values) Writes 16 bit values (as UInt16, or Int16 for an Int16 band). -
write
public void write(int x, int y, int w, int h, short[] values) -
write
public void write(byte[] values) Writes 8 bit values (unsigned). -
write
public void write(int x, int y, int w, int h, byte[] values) -
contours
Contour lines of the band into a vector layer (gdal_contour): the fields "ID" and "ELEV" are created if they don't exist; the no data value of the band is used. Further options of GDALContourGenerateEx, e.g. "LEVEL_BASE=100", "FIXED_LEVELS=500,1000", "POLYGONIZE=YES" (with "ELEV_FIELD_MIN=..." and "ELEV_FIELD_MAX=..."). -
polygonize
Polygons of the areas of equal values (gdal_polygonize) into a vector layer: the value of each polygon in the field (created if it doesn't exist: integer, or real for float bands). useMask: the pixels without data (the mask of the band) get no polygons. Options of GDALPolygonize, e.g. "8CONNECTED=8". -
toString
-