Class GdalDataset
java.lang.Object
com.eco.bio7.gdal.GdalDataset
- All Implemented Interfaces:
AutoCloseable
A dataset of GDAL: a raster (bands of pixels with georeferencing) and/or
vector layers. Close it after use (try-with-resources).
-
Method Summary
Modifier and TypeMethodDescriptionband(int index) The band (1 tobandCount()).intdouble[]bounds()The extent {minX, minY, maxX, maxY} in the coordinates of the dataset (null without georeferencing).voidclose()createLayer(String name, SpatialReference srs, GeometryType type, String... options) A new vector layer (a dataset of a vector driver, seeGdal.createVector(String, String, String...)): its coordinate system (or null), the type of the geometries and the options of the driver (e.g., "GEOMETRY_NAME=geom").The short name of the driver (e.g., "GTiff").executeSql(String sql) Executes SQL (the dialect of the driver, e.g.executeSql(String sql, String dialect) Executes SQL in a dialect ("OGRSQL", "SQLITE", "INDIRECT_SQLITE" or null for the dialect of the driver).files()The files of the dataset (e.g., a shapefile: .shp, .shx, .dbf, .prj).voidflush()Writes the cached data (of a created or updated dataset).double[]The georeferencing (affine transformation): x = gt[0] + col * gt[1] + row * gt[2], y = gt[3] + col * gt[4] + row * gt[5]; null if the dataset has none.intheight()The output of gdalinfo for this dataset (options of gdalinfo, e.g.booleanisClosed()layer(int index) The vector layer (0 tolayerCount()- 1).intlayers()The metadata of a domain (null or "" for the default domain), e.g.path()The path (or name) the dataset was opened or created with.double[]pixelToWorld(double column, double row) The coordinates {x, y} of a pixel position (column, row; 0.5 is the center of the first pixel).The coordinate system as WKT ("" if none).voidsetGeoTransform(double[] gt) voidsetProjection(String crs) Sets the coordinate system (WKT, or "EPSG:4326", a PROJ string, ...).The coordinate system (null if the dataset has none).toString()intwidth()double[]worldToPixel(double x, double y) The pixel position {column, row} of coordinates of the dataset.
-
Method Details
-
path
The path (or name) the dataset was opened or created with. -
width
public int width() -
height
public int height() -
bandCount
public int bandCount() -
band
The band (1 tobandCount()). -
geoTransform
public double[] geoTransform()The georeferencing (affine transformation): x = gt[0] + col * gt[1] + row * gt[2], y = gt[3] + col * gt[4] + row * gt[5]; null if the dataset has none. -
setGeoTransform
public void setGeoTransform(double[] gt) -
projection
The coordinate system as WKT ("" if none). -
setProjection
Sets the coordinate system (WKT, or "EPSG:4326", a PROJ string, ...). -
spatialReference
The coordinate system (null if the dataset has none). Close it after use. -
bounds
public double[] bounds()The extent {minX, minY, maxX, maxY} in the coordinates of the dataset (null without georeferencing). -
pixelToWorld
public double[] pixelToWorld(double column, double row) The coordinates {x, y} of a pixel position (column, row; 0.5 is the center of the first pixel). -
worldToPixel
public double[] worldToPixel(double x, double y) The pixel position {column, row} of coordinates of the dataset. -
driverName
The short name of the driver (e.g., "GTiff"). -
metadata
-
files
-
info
-
layerCount
public int layerCount() -
layer
The vector layer (0 tolayerCount()- 1). -
createLayer
public VectorLayer createLayer(String name, SpatialReference srs, GeometryType type, String... options) A new vector layer (a dataset of a vector driver, seeGdal.createVector(String, String, String...)): its coordinate system (or null), the type of the geometries and the options of the driver (e.g., "GEOMETRY_NAME=geom"). -
executeSql
Executes SQL (the dialect of the driver, e.g. of GeoPackage or SQLite). The result is a layer: close it after use. -
executeSql
Executes SQL in a dialect ("OGRSQL", "SQLITE", "INDIRECT_SQLITE" or null for the dialect of the driver). The result is a layer (null for statements without result): close it after use. -
layers
-
flush
public void flush()Writes the cached data (of a created or updated dataset). -
isClosed
public boolean isClosed() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
toString
-