public class Dataset extends MajorObject
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()
Modifier and Type | Method | Description |
---|---|---|
int |
AbortSQL() |
|
int |
AddBand() |
Add a band to a dataset.
|
int |
AddBand(int datatype) |
Add a band to a dataset.
|
int |
AddBand(int datatype,
java.util.Vector options) |
Add a band to a dataset.
|
int |
AdviseRead(int xoff,
int yoff,
int xsize,
int ysize) |
|
int |
AdviseRead(int xoff,
int yoff,
int xsize,
int ysize,
SWIGTYPE_p_int buf_xsize) |
|
int |
AdviseRead(int xoff,
int yoff,
int xsize,
int ysize,
SWIGTYPE_p_int buf_xsize,
SWIGTYPE_p_int buf_ysize) |
|
int |
AdviseRead(int xoff,
int yoff,
int xsize,
int ysize,
SWIGTYPE_p_int buf_xsize,
SWIGTYPE_p_int buf_ysize,
SWIGTYPE_p_int buf_type) |
|
int |
AdviseRead(int xoff,
int yoff,
int xsize,
int ysize,
SWIGTYPE_p_int buf_xsize,
SWIGTYPE_p_int buf_ysize,
SWIGTYPE_p_int buf_type,
int[] band_list) |
|
int |
AdviseRead(int xoff,
int yoff,
int xsize,
int ysize,
SWIGTYPE_p_int buf_xsize,
SWIGTYPE_p_int buf_ysize,
SWIGTYPE_p_int buf_type,
int[] band_list,
java.util.Vector options) |
|
int |
BuildOverviews(int[] overviewlist) |
Build raster overview(s).
|
int |
BuildOverviews(int[] overviewlist,
ProgressCallback callback) |
Build raster overview(s).
|
int |
BuildOverviews(java.lang.String resampling,
int[] overviewlist) |
Build raster overview(s).
|
int |
BuildOverviews(java.lang.String resampling,
int[] overviewlist,
ProgressCallback callback) |
Build raster overview(s).
|
void |
ClearStatistics() |
|
int |
CommitTransaction() |
|
Layer |
CopyLayer(Layer src_layer,
java.lang.String new_name) |
|
Layer |
CopyLayer(Layer src_layer,
java.lang.String new_name,
java.util.Vector options) |
|
Layer |
CreateLayer(java.lang.String name) |
|
Layer |
CreateLayer(java.lang.String name,
SpatialReference srs) |
|
Layer |
CreateLayer(java.lang.String name,
SpatialReference srs,
int geom_type) |
|
Layer |
CreateLayer(java.lang.String name,
SpatialReference srs,
int geom_type,
java.util.Vector options) |
|
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.
|
int |
DeleteLayer(int index) |
|
Layer |
ExecuteSQL(java.lang.String statement) |
|
Layer |
ExecuteSQL(java.lang.String statement,
Geometry spatialFilter) |
|
Layer |
ExecuteSQL(java.lang.String statement,
Geometry spatialFilter,
java.lang.String dialect) |
|
void |
FlushCache() |
Flush all write cached data to disk.
|
Driver |
GetDriver() |
Fetch the driver to which this dataset relates.
|
java.util.Vector |
GetFileList() |
Fetch files forming dataset.
|
int |
GetGCPCount() |
Get number of GCPs.
|
java.lang.String |
GetGCPProjection() |
Get output projection for GCPs.
|
java.util.Vector |
GetGCPs() |
Fetch GCPs.
|
void |
GetGCPs(java.util.Vector gcpVector) |
Fetch GCPs.
|
SpatialReference |
GetGCPSpatialRef() |
|
double[] |
GetGeoTransform() |
Fetch the affine transformation coefficients.
|
void |
GetGeoTransform(double[] geoTransformArray) |
Fetch the affine transformation coefficients.
|
Layer |
GetLayer(int index) |
|
Layer |
GetLayer(java.lang.String layerName) |
|
Layer |
GetLayerByIndex(int index) |
|
Layer |
GetLayerByName(java.lang.String layer_name) |
|
int |
GetLayerCount() |
|
Feature |
GetNextFeature() |
|
java.lang.String |
GetProjection() |
Fetch the projection definition string for this dataset.
|
java.lang.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.
|
Group |
GetRootGroup() |
|
SpatialReference |
GetSpatialRef() |
|
StyleTable |
GetStyleTable() |
|
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 |
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) |
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,
java.nio.ByteBuffer nioBuffer,
int[] band_list,
int nPixelSpace,
int nLineSpace,
int nBandSpace) |
Read a region of image data from multiple bands.
|
void |
ReleaseResultSet(Layer layer) |
|
void |
ResetReading() |
|
int |
RollbackTransaction() |
|
int |
SetGCPs(GCP[] gcpArray,
java.lang.String GCPProjection) |
Assign GCPs.
|
int |
SetGCPs2(GCP[] nGCPs,
SpatialReference hSRS) |
|
int |
SetGeoTransform(double[] geoTransformArray) |
Set the affine transformation coefficients.
|
int |
SetProjection(java.lang.String projection) |
Set the projection reference string for this dataset.
|
void |
SetSpatialRef(SpatialReference srs) |
|
void |
SetStyleTable(StyleTable table) |
|
int |
StartTransaction() |
|
int |
StartTransaction(int force) |
|
boolean |
TestCapability(java.lang.String cap) |
|
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.
|
int |
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) |
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,
java.nio.ByteBuffer nioBuffer,
int[] band_list,
int nPixelSpace,
int nLineSpace,
int nBandSpace) |
Write a region of image data from multiple bands.
|
GetDescription, GetMetadata_Dict, GetMetadata_Dict, GetMetadata_List, GetMetadata_List, GetMetadataDomainList, GetMetadataItem, GetMetadataItem, SetDescription, SetMetadata, SetMetadata, SetMetadata, SetMetadata, SetMetadata, SetMetadata, SetMetadataItem, SetMetadataItem
public void delete()
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().
delete
in class MajorObject
public int GetRasterXSize()
public int GetRasterYSize()
public int GetRasterCount()
public int BuildOverviews(int[] overviewlist, ProgressCallback callback)
Same as below with resampling == "NEAREST"
BuildOverviews(String resampling, int[] overviewlist, ProgressCallback callback)
public int BuildOverviews(int[] overviewlist)
Same as below with resampling == "NEAREST" and callback == null
BuildOverviews(String resampling, int[] overviewlist, ProgressCallback callback)
public java.util.Vector GetGCPs()
public double[] GetGeoTransform()
Same as below, except the geotransform array is returned by the method
public Layer GetLayer(int index)
public Layer GetLayer(java.lang.String layerName)
public int getRasterXSize()
public int getRasterYSize()
public int getRasterCount()
public Driver GetDriver()
public Band GetRasterBand(int nBandId)
nBandId
- the index number of the band to fetch, from 1 to
GetRasterCount().public Group GetRootGroup()
public java.lang.String GetProjection()
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.
public java.lang.String GetProjectionRef()
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.
public SpatialReference GetSpatialRef()
public int SetProjection(java.lang.String projection)
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.
projection
- projection reference string.public void SetSpatialRef(SpatialReference srs)
public void GetGeoTransform(double[] geoTransformArray)
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.
geoTransformArray
- an existing six double array into which the
transformation will be placed.gdal.ApplyGeoTransform(double[] padfGeoTransform, double dfPixel, double dfLine, double[] pdfGeoX, double[] pdfGeoY)
,
gdal.InvGeoTransform(double[] gt_in)
public int SetGeoTransform(double[] geoTransformArray)
See #GetGeoTransform() for details on the meaning of the geoTransformArray coefficients.
geoTransformArray
- a six double array containing the transformation
coefficients to be written with the dataset.GetGeoTransform(double[] geoTransformArray)
public int BuildOverviews(java.lang.String resampling, int[] overviewlist, ProgressCallback callback)
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 );
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 nullgdal.RegenerateOverviews(Band srcBand, Band[] overviewBands, String resampling, ProgressCallback callback)
public int BuildOverviews(java.lang.String resampling, int[] overviewlist)
Same as below with callback == null
public int GetGCPCount()
public java.lang.String GetGCPProjection()
The projection string follows the normal rules from GetProjectionRef().
public SpatialReference GetGCPSpatialRef()
public void GetGCPs(java.util.Vector gcpVector)
Add to the provided vector the GCPs of the dataset
gcpVector
- non null Vector objectpublic int SetGCPs(GCP[] gcpArray, java.lang.String GCPProjection)
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 responsible for deallocating these arguments if appropriate.
Most formats do not support setting of GCPs, even formats that can handle GCPs. These formats will return CE_Failure.
gcpArray
- array of GCP objects being assignedGCPProjection
- the new OGC WKT coordinate system to assign for the
GCP output coordinates. This parameter should be "" if no output coordinate
system is known.public int SetGCPs2(GCP[] nGCPs, SpatialReference hSRS)
public void FlushCache()
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
delete()
public int AddBand(int datatype, java.util.Vector options)
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()) as the newest band will always be the last band.
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.public int AddBand(int datatype)
Same as below with options == null
AddBand(int datatype, java.util.Vector options)
public int AddBand()
Same as below with datatype == gdalconst.GDT_Byte and options == null
AddBand(int datatype, java.util.Vector options)
public int CreateMaskBand(int nFlags)
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.
public java.util.Vector GetFileList()
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.
public int AdviseRead(int xoff, int yoff, int xsize, int ysize, SWIGTYPE_p_int buf_xsize, SWIGTYPE_p_int buf_ysize, SWIGTYPE_p_int buf_type, int[] band_list, java.util.Vector options)
public int AdviseRead(int xoff, int yoff, int xsize, int ysize, SWIGTYPE_p_int buf_xsize, SWIGTYPE_p_int buf_ysize, SWIGTYPE_p_int buf_type, int[] band_list)
public int AdviseRead(int xoff, int yoff, int xsize, int ysize, SWIGTYPE_p_int buf_xsize, SWIGTYPE_p_int buf_ysize, SWIGTYPE_p_int buf_type)
public int AdviseRead(int xoff, int yoff, int xsize, int ysize, SWIGTYPE_p_int buf_xsize, SWIGTYPE_p_int buf_ysize)
public int AdviseRead(int xoff, int yoff, int xsize, int ysize, SWIGTYPE_p_int buf_xsize)
public int AdviseRead(int xoff, int yoff, int xsize, int ysize)
public Layer CreateLayer(java.lang.String name, SpatialReference srs, int geom_type, java.util.Vector options)
public Layer CreateLayer(java.lang.String name, SpatialReference srs, int geom_type)
public Layer CreateLayer(java.lang.String name, SpatialReference srs)
public Layer CreateLayer(java.lang.String name)
public Layer CopyLayer(Layer src_layer, java.lang.String new_name, java.util.Vector options)
public int DeleteLayer(int index)
public int GetLayerCount()
public Layer GetLayerByIndex(int index)
public Layer GetLayerByName(java.lang.String layer_name)
public void ResetReading()
public Feature GetNextFeature()
public boolean TestCapability(java.lang.String cap)
public Layer ExecuteSQL(java.lang.String statement, Geometry spatialFilter, java.lang.String dialect)
public Layer ExecuteSQL(java.lang.String statement)
public void ReleaseResultSet(Layer layer)
public StyleTable GetStyleTable()
public void SetStyleTable(StyleTable table)
public int AbortSQL()
public int StartTransaction(int force)
public int StartTransaction()
public int CommitTransaction()
public int RollbackTransaction()
public void ClearStatistics()
public int 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)
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.
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.public int 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)
Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0
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)
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.
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 consistent 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.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)
Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0
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)
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)
Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0
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)
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)
Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0
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)
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)
Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0
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)
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)
Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0
public int 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)
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.
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.public int 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)
Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0
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)
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.
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 consistent 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.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)
Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0
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)
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)
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)
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)
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)
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)
Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0
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)
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)
Same as below with nPixelSpace == 0, nLineSpace == 0 and nBandSpace == 0