Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.gdal.gdal
Class Dataset

    java.lang.Object
      org.gdal.gdal.MajorObject
          org.gdal.gdal.Dataset

    public class Dataset

extends MajorObject

Class Dataset is an uninstanciable class providing various methods to access a set of associated raster bands, usually from one file.

The Dataset class is a binding for the C++ GDALDataset class.

A dataset encapsulating one or more raster bands. Details are further discussed in the GDAL Data Model.

Dataset objects are returned by methods from other classes, such as gdal.Open() or Driver.Create() / Driver.CreateCopy()

Method Summary
`int` | `AddBand()` Add a band to a dataset.
`int` | `AddBand(int datatype)` Add a band to a dataset.
`int` | `AddBand(int datatype, Vector options)` Add a band to a dataset.
`int` | `BuildOverviews(int[] overviewlist)` Build raster overview(s).
`int` | `BuildOverviews(int[] overviewlist, ProgressCallback callback)` Build raster overview(s).
`int` | `BuildOverviews(String resampling, int[] overviewlist)` Build raster overview(s).
`int` | `BuildOverviews(String resampling, int[] overviewlist, ProgressCallback callback)` Build raster overview(s).
`int` | `CreateMaskBand(int nFlags)` Adds a mask band to the current band.
`void` | `delete()` Frees the native resource associated to a Dataset object and close the file.
`void` | `FlushCache()` Flush all write cached data to disk.
`Driver` | `GetDriver()` Fetch the driver to which this dataset relates.
`Vector` | `GetFileList()` Fetch files forming dataset.
`int` | `GetGCPCount()` Get number of GCPs.
`String` | `GetGCPProjection()` Get output projection for GCPs.
`Vector` | `GetGCPs()` Fetch GCPs.
`void` | `GetGCPs(Vector gcpVector)` Fetch GCPs.
`double[]` | `GetGeoTransform()` Fetch the affine transformation coefficients.
`void` | `GetGeoTransform(double[] geoTransformArray)` Fetch the affine transformation coefficients.
`String` | `GetProjection()` Fetch the projection definition string for this dataset.
`String` | `GetProjectionRef()` Fetch the projection definition string for this dataset.
`Band` | `GetRasterBand(int nBandId)` Fetch a band object for a dataset.
`int` | `getRasterCount()` Fetch the number of raster bands on this dataset.
`int` | `GetRasterCount()` Fetch the number of raster bands on this dataset.
`int` | `getRasterXSize()` Fetch raster width in pixels.
`int` | `GetRasterXSize()` Fetch raster width in pixels.
`int` | `getRasterYSize()` Fetch raster height in pixels.
`int` | `GetRasterYSize()` Fetch raster height in pixels.
`int` | `ReadRaster_Direct(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, ByteBuffer nioBuffer, int[] band_list)` Read a region of image data from multiple bands.
`int` | `ReadRaster_Direct(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, ByteBuffer nioBuffer, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)` Read a region of image data from multiple bands.
`int` | `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list)` Read a region of image data from multiple bands.
`int` | `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)` Read a region of image data from multiple bands.
`int` | `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, double[] array, int[] band_list)` Read a region of image data from multiple bands.
`int` | `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, double[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)` Read a region of image data from multiple bands.
`int` | `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, float[] array, int[] band_list)` Read a region of image data from multiple bands.
`int` | `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, float[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)` Read a region of image data from multiple bands.
`int` | `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, int[] array, int[] band_list)` Read a region of image data from multiple bands.
`int` | `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, int[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)` Read a region of image data from multiple bands.
`int` | `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, short[] array, int[] band_list)` Read a region of image data from multiple bands.
`int` | `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, short[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)` Read a region of image data from multiple bands.
`int` | `SetGCPs(GCP[] gcpArray, String GCPProjection)` Assign GCPs.
`int` | `SetGeoTransform(double[] geoTransformArray)` Set the affine transformation coefficients.
`int` | `SetProjection(String projection)` Set the projection reference string for this dataset.
`int` | `WriteRaster_Direct(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, ByteBuffer nioBuffer, int[] band_list)` Write a region of image data from multiple bands.
`int` | `WriteRaster_Direct(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, ByteBuffer nioBuffer, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)` Write a region of image data from multiple bands.
`int` | `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list)` Write a region of image data from multiple bands.
`int` | `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)` Write a region of image data from multiple bands.
`int` | `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, double[] array, int[] band_list)` Write a region of image data from multiple bands.
`int` | `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, double[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)` Write a region of image data from multiple bands.
`int` | `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, float[] array, int[] band_list)` Write a region of image data from multiple bands.
`int` | `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, float[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)` Write a region of image data from multiple bands.
`int` | `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, int[] array, int[] band_list)` Write a region of image data from multiple bands.
`int` | `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, int[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)` Write a region of image data from multiple bands.
`int` | `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, short[] array, int[] band_list)` Write a region of image data from multiple bands.
`int` | `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, short[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)` Write a region of image data from multiple bands.

Methods inherited from class org.gdal.gdal.MajorObject
`GetDescription, GetMetadata_Dict, GetMetadata_Dict, GetMetadata_List, GetMetadata_List, GetMetadataItem, GetMetadataItem, SetDescription, SetMetadata, SetMetadata, SetMetadata, SetMetadata, SetMetadata, SetMetadata, SetMetadataItem, SetMetadataItem`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### delete

    public void delete()

  Frees the native resource associated to a Dataset object and close the file. This method will delete the underlying C++ object. After it has been called, all native resources will have been destroyed, so it will be illegal (and likely to cause JVM crashes) to use any method on this object or any derived objects, such as Band objects of this Dataset.

  The delete() method must be called when a dataset has been opened in update or creation mode, otherwise data might not be properly flushed to the disk. You cannot rely on the finalization to call delete().

  Overrides:
    `delete` in class `MajorObject`

### GetRasterXSize

    public int GetRasterXSize()

  Fetch raster width in pixels.

  Returns:
    the width in pixels of raster bands in this Dataset.
  Since:
    Java bindings 1.7.0

### GetRasterYSize

    public int GetRasterYSize()

  Fetch raster height in pixels.

  Returns:
    the heigt in pixels of raster bands in this Dataset.
  Since:
    Java bindings 1.7.0

### GetRasterCount

    public int GetRasterCount()

  Fetch the number of raster bands on this dataset.

  Returns:
    the number of raster bands.
  Since:
    Java bindings 1.7.0

### BuildOverviews

    public int BuildOverviews(int[] overviewlist,
                              ProgressCallback callback)

  Build raster overview(s). Same as below with resampling == "NEAREST"

  Since:
    Java bindings 1.7.0
  See Also:
    `BuildOverviews(String resampling, int[] overviewlist, ProgressCallback callback)`

### BuildOverviews

    public int BuildOverviews(int[] overviewlist)

  Build raster overview(s). Same as below with resampling == "NEAREST" and callback == null

  Since:
    Java bindings 1.7.0
  See Also:
    `BuildOverviews(String resampling, int[] overviewlist, ProgressCallback callback)`

### GetGCPs

    public Vector GetGCPs()

  Fetch GCPs.

  Returns:
    a vector of GCP objects
  Since:
    Java bindings 1.7.0

### GetGeoTransform

    public double[] GetGeoTransform()

  Fetch the affine transformation coefficients. Same as below, except the geotransform array is returned by the method

  Since:
    Java bindings 1.7.0
  See Also:
    `GetGeoTransform(double[] geoTransformArray)`, `gdal.ApplyGeoTransform(double[] padfGeoTransform, double dfPixel, double dfLine, double[] pdfGeoX, double[] pdfGeoY)`, `gdal.InvGeoTransform(double[] gt_in)`

### getRasterXSize

    public int getRasterXSize()

  Fetch raster width in pixels.

  Returns:
    the width in pixels of raster bands in this Dataset.

### getRasterYSize

    public int getRasterYSize()

  Fetch raster height in pixels.

  Returns:
    the heigt in pixels of raster bands in this Dataset.

### getRasterCount

    public int getRasterCount()

  Fetch the number of raster bands on this dataset.

  Returns:
    the number of raster bands.

### GetDriver

    public Driver GetDriver()

  Fetch the driver to which this dataset relates.

  Returns:
    the driver on which the dataset was created with gdal.Open() or Driver.Create().

### GetRasterBand

    public Band GetRasterBand(int nBandId)

  Fetch a band object for a dataset.

  Parameters:
    `nBandId` - the index number of the band to fetch, from 1 to GetRasterCount().
  Returns:
    the nBandId th band object

### GetProjection

    public String GetProjection()

  Fetch the projection definition string for this dataset. The returned string defines the projection coordinate system of the image in OpenGIS WKT format. It should be suitable for use with the OGRSpatialReference class. When a projection definition is not available an empty (but not null) string is returned.

  Returns:
    the projection string.
  See Also:
    OSR tutorial

### GetProjectionRef

    public String GetProjectionRef()

  Fetch the projection definition string for this dataset. The returned string defines the projection coordinate system of the image in OpenGIS WKT format. It should be suitable for use with the OGRSpatialReference class. When a projection definition is not available an empty (but not null) string is returned.

  Returns:
    the projection string.
  See Also:
    OSR tutorial

### SetProjection

    public int SetProjection(String projection)

  Set the projection reference string for this dataset. The string should be in OGC WKT or PROJ.4 format. An error may occur because of incorrectly specified projection strings, because the dataset is not writable, or because the dataset does not support the indicated projection. Many formats do not support writing projections.

  Parameters:
    `projection` - projection reference string.
  Returns:
    gdalconst.CE_Failure if an error occurs, otherwise gdalconst.CE_None.

### GetGeoTransform

    public void GetGeoTransform(double[] geoTransformArray)

  Fetch the affine transformation coefficients. Fetches the coefficients for transforming between pixel/line (P,L) raster space, and projection coordinates (Xp,Yp) space.

         Xp = geoTransformArray[0] + P*geoTransformArray[1] + L*geoTransformArray[2];
         Yp = geoTransformArray[3] + P*geoTransformArray[4] + L*geoTransformArray[5];

  In a north up image, geoTransformArray[1] is the pixel width, and geoTransformArray[5] is the pixel height. The upper left corner of the upper left pixel is at position (geoTransformArray[0],geoTransformArray[3]).

  The default transform is (0,1,0,0,0,1) and should be returned even when an error occurs, such as for formats that don't support transformation to projection coordinates.

  NOTE: GetGeoTransform() isn't expressive enough to handle the variety of OGC Grid Coverages pixel/line to projection transformation schemes. Eventually this method will be depreciated in favour of a more general scheme.

  Parameters:
    `geoTransformArray` - an existing six double array into which the transformation will be placed.
  See Also:
    `gdal.ApplyGeoTransform(double[] padfGeoTransform, double dfPixel, double dfLine, double[] pdfGeoX, double[] pdfGeoY)`, `gdal.InvGeoTransform(double[] gt_in)`

### SetGeoTransform

    public int SetGeoTransform(double[] geoTransformArray)

  Set the affine transformation coefficients. See #GetGeoTransform() for details on the meaning of the geoTransformArray coefficients.

  Parameters:
    `geoTransformArray` - a six double array containing the transformation coefficients to be written with the dataset.
  Returns:
    gdalconst.CE_None on success, or gdalconst.CE_Failure if this transform cannot be written.
  See Also:
    `GetGeoTransform(double[] geoTransformArray)`

### BuildOverviews

    public int BuildOverviews(String resampling,
                              int[] overviewlist,
                              ProgressCallback callback)

  Build raster overview(s). If the operation is unsupported for the indicated dataset, then gdalconst.CE_Failure is returned, and gdal.GetLastErrorNo() will return gdalconst.CPLE_NotSupported.

  For example, to build overview level 2, 4 and 8 on all bands the following call could be made:

         ds.BuildOverviews( "NEAREST", new int[] { 2, 4, 8 }, null );

  Parameters:
    `resampling` - one of "NEAREST", "GAUSS", "AVERAGE", "AVERAGE_MAGPHASE" or "NONE" controlling the downsampling method applied.
    `overviewlist` - the list of overview decimation factors to build.
    `callback` - for reporting progress or null
  Returns:
    gdalconst.CE_None on success or gdalconst.CE_Failure if the operation doesn't work.
  Since:
    Java bindings 1.7.0
  See Also:
    `gdal.RegenerateOverviews(Band srcBand, Band[] overviewBands, String resampling, ProgressCallback callback)`

### BuildOverviews

    public int BuildOverviews(String resampling,
                              int[] overviewlist)

  Build raster overview(s). Same as below with callback == null

  See Also:
    `BuildOverviews(String resampling, int[] overviewlist, ProgressCallback callback)`

### GetGCPCount

    public int GetGCPCount()

  Get number of GCPs.

  Returns:
    number of GCPs for this dataset. Zero if there are none.

### GetGCPProjection

    public String GetGCPProjection()

  Get output projection for GCPs. The projection string follows the normal rules from GetProjectionRef().

  Returns:
    projection string or "" if there are no GCPs.

### GetGCPs

    public void GetGCPs(Vector gcpVector)

  Fetch GCPs. Add to the provided vector the GCPs of the dataset

  Parameters:
    `gcpVector` - non null Vector object

### SetGCPs

    public int SetGCPs(GCP[] gcpArray,
                       String GCPProjection)

  Assign GCPs. This method assigns the passed set of GCPs to this dataset, as well as setting their coordinate system. Internally copies are made of the coordinate system and list of points, so the caller remains resposible for deallocating these arguments if appropriate.

  Most formats do not support setting of GCPs, even foramts that can handle GCPs. These formats will return CE_Failure.

  Parameters:
    `gcpArray` - array of GCP objects being assigned
    `GCPProjection` - the new OGC WKT coordinate system to assign for the GCP output coordinates. This parameter should be "" if no output coordinate system is known.
  Returns:
    gdalconst.CE_None on success, gdalconst.CE_Failure on failure (including if action is not supported for this format).
  Since:
    Java bindings 1.7.0

### FlushCache

    public void FlushCache()

  Flush all write cached data to disk. Any raster (or other GDAL) data written via GDAL calls, but buffered internally will be written to disk.

  Calling this method is generally not sufficient to ensure that the file is in a consistent state. You must call delete() for that

  See Also:
    `delete()`

### AddBand

    public int AddBand(int datatype,
                       Vector options)

  Add a band to a dataset. This method will add a new band to the dataset if the underlying format supports this action. Except VRT and MEM drivers, most formats do not. Note that the new Band object is not returned. It may be fetched after successful completion of the method by calling ds.GetRasterBand(ds.GetRasterCount()-1) as the newest band will always be the last band.

  Parameters:
    `datatype` - the data type of the pixels in the new band.
    `options` - a vector of options strings, each being "NAME=VALUE". The supported options are format specific. null may be passed by default.
  Returns:
    gdalconst.CE_None on success or gdalconst.CE_Failure on failure.

### AddBand

    public int AddBand(int datatype)

  Add a band to a dataset. Same as below with options == null

  Since:
    Java bindings 1.7.0
  See Also:
    `AddBand(int datatype, java.util.Vector options)`

### AddBand

    public int AddBand()

  Add a band to a dataset. Same as below with datatype == gdalconst.GDT_Byte and options == null

  Since:
    Java bindings 1.7.0
  See Also:
    `AddBand(int datatype, java.util.Vector options)`

### CreateMaskBand

    public int CreateMaskBand(int nFlags)

  Adds a mask band to the current band. The default implementation of the CreateMaskBand() method is implemented based on similar rules to the .ovr handling implemented using the GDALDefaultOverviews object. A TIFF file with the extension .msk will be created with the same basename as the original file, and it will have as many bands as the original image (or just one for GMF_PER_DATASET). The mask images will be deflate compressed tiled images with the same block size as the original image if possible.

  Returns:
    gdalconst.CE_None on success or gdalconst.CE_Failure on an error.
  Since:
    GDAL 1.5.0
  See Also:
    RFC 15 - No data bit mask

### GetFileList

    public Vector GetFileList()

  Fetch files forming dataset. Returns a list of files believed to be part of this dataset. If it returns an empty list of files it means there is believed to be no local file system files associated with the dataset (for instance a virtual dataset).

  The returned filenames will normally be relative or absolute paths depending on the path used to originally open the dataset.

  Returns:
    null or a vector of strings of file names.

### ReadRaster_Direct

    public int ReadRaster_Direct(int xoff,
                                 int yoff,
                                 int xsize,
                                 int ysize,
                                 int buf_xsize,
                                 int buf_ysize,
                                 int buf_type,
                                 ByteBuffer nioBuffer,
                                 int[] band_list,
                                 int nPixelSpace,
                                 int nLineSpace,
                                 int nBandSpace)

  Read a region of image data from multiple bands. This method allows reading a region of one or more Band's from this dataset into a buffer. It automatically takes care of data type translation if the data type (buf_type) of the buffer is different than that of the Band. The method also takes care of image decimation / replication if the buffer size (buf_xsize x buf_ysize) is different than the size of the region being accessed (xsize x ysize).

  The nPixelSpace, nLineSpace and nBandSpace parameters allow reading into or writing from various organization of buffers.

  For highest performance full resolution data access, read on "block boundaries" as returned by Band.GetBlockSize(int[], int[]), or use the Band.ReadBlock(int, int, java.nio.ByteBuffer) method.

  When requesting a multi-byte datatype (GDT_Int16, GDT_Int32, GDT_Float32, ...), you should generally set the byte order of the buffer to the native order of the machine with nioBuffer.order(ByteOrder.nativeOrder()) (the default is BIG_ENDIAN) if you use the getShort(), getInt(), getFloat(), ... methods of the ByteBuffer class.

  Parameters:
    `xoff` - The pixel offset to the top left corner of the region of the band to be accessed. This would be zero to start from the left side.
    `yoff` - The line offset to the top left corner of the region of the band to be accessed. This would be zero to start from the top.
    `xsize` - The width of the region of the band to be accessed in pixels.
    `ysize` - The height of the region of the band to be accessed in lines.
    `buf_xsize` - the width of the buffer image into which the desired region is to be read.
    `buf_ysize` - the height of the buffer image into which the desired region is to be read.
    `buf_type` - the type of the pixel values in the nioBuffer data buffer. One of gdalconstConstants.GDT_Byte, gdalconstConstants.GDT_Int16, ... The pixel values will automatically be translated to/from the Band data type as needed.
    `nioBuffer` - The buffer into which the data will be written. This buffer must contain at least buf_xsize * buf_ysize * nBandCount words of type buf_type. It is organized in left to right,top to bottom pixel order. Spacing is controlled by the nPixelSpace, and nLineSpace parameters.
    `band_list` - the list of band numbers being read/written. Note band numbers are 1 based. This may be null to select the first nBandCount bands.
    `nPixelSpace` - The byte offset from the start of one pixel value in the buffer to the start of the next pixel value within a scanline. If defaulted (0) the size of the datatype buf_type is used.
    `nLineSpace` - The byte offset from the start of one scanline in the buffer to the start of the next. If defaulted the size of the datatype buf_type * buf_xsize is used.
    `nBandSpace` - the byte offset from the start of one bands data to the start of the next. If defaulted (zero) the value will be nLineSpace * buf_ysize implying band sequential organization of the data buffer.
  Returns:
    gdalconst.CE_Failure if the access fails, otherwise gdalconst.CE_None.
  Since:
    Java bindings 1.7.0

### ReadRaster_Direct

    public int ReadRaster_Direct(int xoff,
                                 int yoff,
                                 int xsize,
                                 int ysize,
                                 int buf_xsize,
                                 int buf_ysize,
                                 int buf_type,
                                 ByteBuffer nioBuffer,
                                 int[] band_list)

  Read a region of image data from multiple bands. Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0

  Since:
    Java bindings 1.7.0
  See Also:
    `ReadRaster_Direct(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, java.nio.ByteBuffer nioBuffer, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### ReadRaster

    public int ReadRaster(int xoff,
                          int yoff,
                          int xsize,
                          int ysize,
                          int buf_xsize,
                          int buf_ysize,
                          int buf_type,
                          byte[] array,
                          int[] band_list,
                          int nPixelSpace,
                          int nLineSpace,
                          int nBandSpace)

  Read a region of image data from multiple bands. This method allows reading a region of one or more Band's from this dataset into a buffer. It automatically takes care of data type translation if the data type (buf_type) of the buffer is different than that of the Band. The method also takes care of image decimation / replication if the buffer size (buf_xsize x buf_ysize) is different than the size of the region being accessed (xsize x ysize).

  The nPixelSpace, nLineSpace and nBandSpace parameters allow reading into or writing from various organization of buffers.

  For highest performance full resolution data access, read on "block boundaries" as returned by Band.GetBlockSize(int[], int[]), or use the Band.ReadBlock(int, int, java.nio.ByteBuffer) method.

  Parameters:
    `xoff` - The pixel offset to the top left corner of the region of the band to be accessed. This would be zero to start from the left side.
    `yoff` - The line offset to the top left corner of the region of the band to be accessed. This would be zero to start from the top.
    `xsize` - The width of the region of the band to be accessed in pixels.
    `ysize` - The height of the region of the band to be accessed in lines.
    `buf_xsize` - the width of the buffer image into which the desired region is to be read.
    `buf_ysize` - the height of the buffer image into which the desired region is to be read.
    `buf_type` - the type of the pixel values in the array. One of gdalconstConstants.GDT_Byte, gdalconstConstants.GDT_Int16, ... The pixel values will automatically be translated to/from the Band data type as needed. The GDAL type must be consistant with the type of the Java array.
    `array` - The array into which the data will be written. This buffer must contain at least buf_xsize * buf_ysize elements * nBandCount . It is organized in left to right,top to bottom pixel order. Spacing is controlled by the nPixelSpace, and nLineSpace parameters.
    `band_list` - the list of band numbers being read/written. Note band numbers are 1 based. This may be null to select the first nBandCount bands.
    `nPixelSpace` - The byte offset from the start of one pixel value in the buffer to the start of the next pixel value within a scanline. If defaulted (0) the size of the datatype buf_type is used.
    `nLineSpace` - The byte offset from the start of one scanline in the buffer to the start of the next. If defaulted the size of the datatype buf_type * buf_xsize is used.
    `nBandSpace` - the byte offset from the start of one bands data to the start of the next. If defaulted (zero) the value will be nLineSpace * buf_ysize implying band sequential organization of the data buffer.
  Returns:
    gdalconst.CE_Failure if the access fails, otherwise gdalconst.CE_None.
  Since:
    Java bindings 1.7.0

### ReadRaster

    public int ReadRaster(int xoff,
                          int yoff,
                          int xsize,
                          int ysize,
                          int buf_xsize,
                          int buf_ysize,
                          int buf_type,
                          byte[] array,
                          int[] band_list)

  Read a region of image data from multiple bands. Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0

  Since:
    Java bindings 1.7.0
  See Also:
    `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### ReadRaster

    public int ReadRaster(int xoff,
                          int yoff,
                          int xsize,
                          int ysize,
                          int buf_xsize,
                          int buf_ysize,
                          int buf_type,
                          short[] array,
                          int[] band_list,
                          int nPixelSpace,
                          int nLineSpace,
                          int nBandSpace)

  Read a region of image data from multiple bands.

  Since:
    Java bindings 1.7.0
  See Also:
    `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### ReadRaster

    public int ReadRaster(int xoff,
                          int yoff,
                          int xsize,
                          int ysize,
                          int buf_xsize,
                          int buf_ysize,
                          int buf_type,
                          short[] array,
                          int[] band_list)

  Read a region of image data from multiple bands. Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0

  Since:
    Java bindings 1.7.0
  See Also:
    `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, short[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### ReadRaster

    public int ReadRaster(int xoff,
                          int yoff,
                          int xsize,
                          int ysize,
                          int buf_xsize,
                          int buf_ysize,
                          int buf_type,
                          int[] array,
                          int[] band_list,
                          int nPixelSpace,
                          int nLineSpace,
                          int nBandSpace)

  Read a region of image data from multiple bands.

  Since:
    Java bindings 1.7.0
  See Also:
    `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### ReadRaster

    public int ReadRaster(int xoff,
                          int yoff,
                          int xsize,
                          int ysize,
                          int buf_xsize,
                          int buf_ysize,
                          int buf_type,
                          int[] array,
                          int[] band_list)

  Read a region of image data from multiple bands. Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0

  Since:
    Java bindings 1.7.0
  See Also:
    `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, int[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### ReadRaster

    public int ReadRaster(int xoff,
                          int yoff,
                          int xsize,
                          int ysize,
                          int buf_xsize,
                          int buf_ysize,
                          int buf_type,
                          float[] array,
                          int[] band_list,
                          int nPixelSpace,
                          int nLineSpace,
                          int nBandSpace)

  Read a region of image data from multiple bands.

  Since:
    Java bindings 1.7.0
  See Also:
    `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### ReadRaster

    public int ReadRaster(int xoff,
                          int yoff,
                          int xsize,
                          int ysize,
                          int buf_xsize,
                          int buf_ysize,
                          int buf_type,
                          float[] array,
                          int[] band_list)

  Read a region of image data from multiple bands. Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0

  Since:
    Java bindings 1.7.0
  See Also:
    `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, float[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### ReadRaster

    public int ReadRaster(int xoff,
                          int yoff,
                          int xsize,
                          int ysize,
                          int buf_xsize,
                          int buf_ysize,
                          int buf_type,
                          double[] array,
                          int[] band_list,
                          int nPixelSpace,
                          int nLineSpace,
                          int nBandSpace)

  Read a region of image data from multiple bands.

  Since:
    Java bindings 1.7.0
  See Also:
    `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### ReadRaster

    public int ReadRaster(int xoff,
                          int yoff,
                          int xsize,
                          int ysize,
                          int buf_xsize,
                          int buf_ysize,
                          int buf_type,
                          double[] array,
                          int[] band_list)

  Read a region of image data from multiple bands. Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0

  Since:
    Java bindings 1.7.0
  See Also:
    `ReadRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, double[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### WriteRaster_Direct

    public int WriteRaster_Direct(int xoff,
                                  int yoff,
                                  int xsize,
                                  int ysize,
                                  int buf_xsize,
                                  int buf_ysize,
                                  int buf_type,
                                  ByteBuffer nioBuffer,
                                  int[] band_list,
                                  int nPixelSpace,
                                  int nLineSpace,
                                  int nBandSpace)

  Write a region of image data from multiple bands. This method allows writing data from a buffer into a region of the Band's. It automatically takes care of data type translation if the data type (buf_type) of the buffer is different than that of the Band. The method also takes care of image decimation / replication if the buffer size (buf_xsize x buf_ysize) is different than the size of the region being accessed (xsize x ysize).

  The nPixelSpace, nLineSpace and nBandSpace parameters allow reading into or writing from various organization of buffers.

  For highest performance full resolution data access, write on "block boundaries" as returned by Band.GetBlockSize(int[], int[]), or use the Band.WriteBlock(int, int, java.nio.ByteBuffer) method.

  Before writing into a multi-byte datatype buffer (GDT_Int16, GDT_Int32, GDT_Float32, ...), you should generally set the byte order of the buffer to the native order of the machine with nioBuffer.order(ByteOrder.nativeOrder()) (the default is BIG_ENDIAN) if you use the putShort(), putInt(), putFloat(), ... methods of the ByteBuffer class.

  Parameters:
    `xoff` - The pixel offset to the top left corner of the region of the band to be accessed. This would be zero to start from the left side.
    `yoff` - The line offset to the top left corner of the region of the band to be accessed. This would be zero to start from the top.
    `xsize` - The width of the region of the band to be accessed in pixels.
    `ysize` - The height of the region of the band to be accessed in lines.
    `buf_xsize` - the width of the buffer image from which the desired region is to be written.
    `buf_ysize` - the height of the buffer image from which the desired region is to be written.
    `buf_type` - the type of the pixel values in the nioBuffer data buffer. One of gdalconstConstants.GDT_Byte, gdalconstConstants.GDT_Int16, ... The pixel values will automatically be translated to/from the Band data type as needed.
    `nioBuffer` - The buffer into which the data should be read, or from which it should be written. This buffer must contain at least buf_xsize * buf_ysize * nBandCount words of type buf_type. It is organized in left to right,top to bottom pixel order. Spacing is controlled by the nPixelSpace, and nLineSpace parameters.
    `band_list` - the list of band numbers being read/written. Note band numbers are 1 based. This may be null to select the first nBandCount bands.
    `nPixelSpace` - The byte offset from the start of one pixel value in the buffer to the start of the next pixel value within a scanline. If defaulted (0) the size of the datatype buf_type is used.
    `nLineSpace` - The byte offset from the start of one scanline in the buffer to the start of the next. If defaulted the size of the datatype buf_type * buf_xsize is used.
    `nBandSpace` - the byte offset from the start of one bands data to the start of the next. If defaulted (zero) the value will be nLineSpace * buf_ysize implying band sequential organization of the data buffer.
  Returns:
    gdalconst.CE_Failure if the access fails, otherwise gdalconst.CE_None.
  Since:
    Java bindings 1.7.0

### WriteRaster_Direct

    public int WriteRaster_Direct(int xoff,
                                  int yoff,
                                  int xsize,
                                  int ysize,
                                  int buf_xsize,
                                  int buf_ysize,
                                  int buf_type,
                                  ByteBuffer nioBuffer,
                                  int[] band_list)

  Write a region of image data from multiple bands. Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0

  Since:
    Java bindings 1.7.0
  See Also:
    `WriteRaster_Direct(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, java.nio.ByteBuffer nioBuffer, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### WriteRaster

    public int WriteRaster(int xoff,
                           int yoff,
                           int xsize,
                           int ysize,
                           int buf_xsize,
                           int buf_ysize,
                           int buf_type,
                           byte[] array,
                           int[] band_list,
                           int nPixelSpace,
                           int nLineSpace,
                           int nBandSpace)

  Write a region of image data from multiple bands. This method allows writing data from a buffer into a region of the Band's. It automatically takes care of data type translation if the data type (buf_type) of the buffer is different than that of the Band. The method also takes care of image decimation / replication if the buffer size (buf_xsize x buf_ysize) is different than the size of the region being accessed (xsize x ysize).

  The nPixelSpace, nLineSpace and nBandSpace parameters allow reading into or writing from various organization of buffers.

  For highest performance full resolution data access, write on "block boundaries" as returned by Band.GetBlockSize(int[], int[]), or use the Band.WriteBlock(int, int, java.nio.ByteBuffer) method.

  Parameters:
    `xoff` - The pixel offset to the top left corner of the region of the band to be accessed. This would be zero to start from the left side.
    `yoff` - The line offset to the top left corner of the region of the band to be accessed. This would be zero to start from the top.
    `xsize` - The width of the region of the band to be accessed in pixels.
    `ysize` - The height of the region of the band to be accessed in lines.
    `buf_xsize` - the width of the buffer image from which the desired region is to be written.
    `buf_ysize` - the height of the buffer image from which the desired region is to be written.
    `buf_type` - the type of the pixel values in the array. One of gdalconstConstants.GDT_Byte, gdalconstConstants.GDT_Int16, ... The pixel values will automatically be translated to/from the Band data type as needed. The GDAL type must be consistant with the type of the Java array.
    `array` - The array from which the data will be read. This buffer must contain at least buf_xsize * buf_ysize elements * nBandCount . It is organized in left to right,top to bottom pixel order. Spacing is controlled by the nPixelSpace, and nLineSpace parameters.
    `band_list` - the list of band numbers being read/written. Note band numbers are 1 based. This may be null to select the first nBandCount bands.
    `nPixelSpace` - The byte offset from the start of one pixel value in the buffer to the start of the next pixel value within a scanline. If defaulted (0) the size of the datatype buf_type is used.
    `nLineSpace` - The byte offset from the start of one scanline in the buffer to the start of the next. If defaulted the size of the datatype buf_type * buf_xsize is used.
    `nBandSpace` - the byte offset from the start of one bands data to the start of the next. If defaulted (zero) the value will be nLineSpace * buf_ysize implying band sequential organization of the data buffer.
  Returns:
    gdalconst.CE_Failure if the access fails, otherwise gdalconst.CE_None.
  Since:
    Java bindings 1.7.0

### WriteRaster

    public int WriteRaster(int xoff,
                           int yoff,
                           int xsize,
                           int ysize,
                           int buf_xsize,
                           int buf_ysize,
                           int buf_type,
                           byte[] array,
                           int[] band_list)

  Write a region of image data from multiple bands. Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0

  Since:
    Java bindings 1.7.0
  See Also:
    `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### WriteRaster

    public int WriteRaster(int xoff,
                           int yoff,
                           int xsize,
                           int ysize,
                           int buf_xsize,
                           int buf_ysize,
                           int buf_type,
                           short[] array,
                           int[] band_list,
                           int nPixelSpace,
                           int nLineSpace,
                           int nBandSpace)

  Write a region of image data from multiple bands.

  Since:
    Java bindings 1.7.0
  See Also:
    `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### WriteRaster

    public int WriteRaster(int xoff,
                           int yoff,
                           int xsize,
                           int ysize,
                           int buf_xsize,
                           int buf_ysize,
                           int buf_type,
                           short[] array,
                           int[] band_list)

  Write a region of image data from multiple bands. Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0

  Since:
    Java bindings 1.7.0
  See Also:
    `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, short[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### WriteRaster

    public int WriteRaster(int xoff,
                           int yoff,
                           int xsize,
                           int ysize,
                           int buf_xsize,
                           int buf_ysize,
                           int buf_type,
                           int[] array,
                           int[] band_list,
                           int nPixelSpace,
                           int nLineSpace,
                           int nBandSpace)

  Write a region of image data from multiple bands.

  Since:
    Java bindings 1.7.0
  See Also:
    `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### WriteRaster

    public int WriteRaster(int xoff,
                           int yoff,
                           int xsize,
                           int ysize,
                           int buf_xsize,
                           int buf_ysize,
                           int buf_type,
                           int[] array,
                           int[] band_list)

  Write a region of image data from multiple bands. Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0

  Since:
    Java bindings 1.7.0
  See Also:
    `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, int[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### WriteRaster

    public int WriteRaster(int xoff,
                           int yoff,
                           int xsize,
                           int ysize,
                           int buf_xsize,
                           int buf_ysize,
                           int buf_type,
                           float[] array,
                           int[] band_list,
                           int nPixelSpace,
                           int nLineSpace,
                           int nBandSpace)

  Write a region of image data from multiple bands.

  Since:
    Java bindings 1.7.0
  See Also:
    `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### WriteRaster

    public int WriteRaster(int xoff,
                           int yoff,
                           int xsize,
                           int ysize,
                           int buf_xsize,
                           int buf_ysize,
                           int buf_type,
                           float[] array,
                           int[] band_list)

  Write a region of image data from multiple bands. Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0

  Since:
    Java bindings 1.7.0
  See Also:
    `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, float[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### WriteRaster

    public int WriteRaster(int xoff,
                           int yoff,
                           int xsize,
                           int ysize,
                           int buf_xsize,
                           int buf_ysize,
                           int buf_type,
                           double[] array,
                           int[] band_list,
                           int nPixelSpace,
                           int nLineSpace,
                           int nBandSpace)

  Write a region of image data from multiple bands.

  Since:
    Java bindings 1.7.0
  See Also:
    `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, byte[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

### WriteRaster

    public int WriteRaster(int xoff,
                           int yoff,
                           int xsize,
                           int ysize,
                           int buf_xsize,
                           int buf_ysize,
                           int buf_type,
                           double[] array,
                           int[] band_list)

  Write a region of image data from multiple bands. Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0

  Since:
    Java bindings 1.7.0
  See Also:
    `WriteRaster(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type, double[] array, int[] band_list, int nPixelSpace, int nLineSpace, int nBandSpace)`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD