|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gdal.gdal.gdal
public class gdal
Class gdal is an uninstanciable class providing various utility functions as static methods.
In particular, it provides :
Method Summary | |
---|---|
static void |
AllRegister()
Register all known configured GDAL drivers. |
static void |
ApplyGeoTransform(double[] padfGeoTransform,
double dfPixel,
double dfLine,
double[] pdfGeoX,
double[] pdfGeoY)
Apply GeoTransform to x/y coordinate. |
static Dataset |
AutoCreateWarpedVRT(Dataset src_ds)
Create virtual warped dataset automatically. |
static Dataset |
AutoCreateWarpedVRT(Dataset src_ds,
String src_wkt)
Create virtual warped dataset automatically. |
static Dataset |
AutoCreateWarpedVRT(Dataset src_ds,
String src_wkt,
String dst_wkt)
Create virtual warped dataset automatically. |
static Dataset |
AutoCreateWarpedVRT(Dataset src_ds,
String src_wkt,
String dst_wkt,
int eResampleAlg)
Create virtual warped dataset automatically. |
static Dataset |
AutoCreateWarpedVRT(Dataset src_ds,
String src_wkt,
String dst_wkt,
int eResampleAlg,
double maxError)
Create virtual warped dataset automatically. |
static int |
ComputeMedianCutPCT(Band red,
Band green,
Band blue,
int num_colors,
ColorTable colors)
Compute optimal PCT for RGB image. |
static int |
ComputeMedianCutPCT(Band red,
Band green,
Band blue,
int num_colors,
ColorTable colors,
ProgressCallback callback)
Compute optimal PCT for RGB image. |
static int |
ComputeProximity(Band srcBand,
Band proximityBand)
Compute the proximity of all pixels in the image to a set of pixels in the source image. |
static int |
ComputeProximity(Band srcBand,
Band proximityBand,
Vector options)
Compute the proximity of all pixels in the image to a set of pixels in the source image. |
static int |
ComputeProximity(Band srcBand,
Band proximityBand,
Vector options,
ProgressCallback callback)
Compute the proximity of all pixels in the image to a set of pixels in the source image. |
static String |
CPLBinaryToHex(byte[] nBytes)
|
static byte[] |
CPLHexToBinary(String pszHex)
|
static int |
DataTypeIsComplex(int eDataType)
Is data type complex? |
static void |
Debug(String msg_class,
String message)
Display a debugging message. |
static String |
DecToDMS(double dfAngle,
String pszAxis)
|
static String |
DecToDMS(double dfAngle,
String pszAxis,
int nPrecision)
|
static double |
DecToPackedDMS(double dfDec)
|
static int |
DitherRGB2PCT(Band red,
Band green,
Band blue,
Band target,
ColorTable colors)
24bit to 8bit conversion with dithering. |
static int |
DitherRGB2PCT(Band red,
Band green,
Band blue,
Band target,
ColorTable colors,
ProgressCallback callback)
24bit to 8bit conversion with dithering. |
static void |
Error(int msg_class,
int err_code,
String msg)
Report an error. |
static void |
ErrorReset()
Erase any traces of previous errors. |
static String |
EscapeString(byte[] byteArray,
int scheme)
Apply escaping to string to preserve special characters. |
static String |
EscapeString(String str,
int scheme)
Apply escaping to string to preserve special characters. |
static void |
FileFromMemBuffer(String fileName,
byte[] byteArray)
Create memory "file" from a buffer. |
static int |
FillNodata(Band targetBand,
Band maskBand,
double maxSearchDist,
int smoothingIterations)
Fill selected raster regions by interpolation from the edges. |
static int |
FillNodata(Band targetBand,
Band maskBand,
double maxSearchDist,
int smoothingIterations,
Vector options)
Fill selected raster regions by interpolation from the edges. |
static int |
FillNodata(Band targetBand,
Band maskBand,
double maxSearchDist,
int smoothingIterations,
Vector options,
ProgressCallback callback)
Fill selected raster regions by interpolation from the edges. |
static void |
FinderClean()
|
static String |
FindFile(String pszClass,
String pszBasename)
|
static int |
GCPsToGeoTransform(GCP[] gcpArray,
double[] outGeoTransform)
Generate Geotransform from GCPs. |
static int |
GCPsToGeoTransform(GCP[] gcpArray,
double[] outGeoTransform,
int bApproxOK)
Generate Geotransform from GCPs. |
static double |
GDAL_GCP_GCPLine_get(GCP gcp)
|
static void |
GDAL_GCP_GCPLine_set(GCP gcp,
double dfGCPLine)
|
static double |
GDAL_GCP_GCPPixel_get(GCP gcp)
|
static void |
GDAL_GCP_GCPPixel_set(GCP gcp,
double dfGCPPixel)
|
static double |
GDAL_GCP_GCPX_get(GCP gcp)
|
static void |
GDAL_GCP_GCPX_set(GCP gcp,
double dfGCPX)
|
static double |
GDAL_GCP_GCPY_get(GCP gcp)
|
static void |
GDAL_GCP_GCPY_set(GCP gcp,
double dfGCPY)
|
static double |
GDAL_GCP_GCPZ_get(GCP gcp)
|
static void |
GDAL_GCP_GCPZ_set(GCP gcp,
double dfGCPZ)
|
static double |
GDAL_GCP_get_GCPLine(GCP gcp)
|
static double |
GDAL_GCP_get_GCPPixel(GCP gcp)
|
static double |
GDAL_GCP_get_GCPX(GCP gcp)
|
static double |
GDAL_GCP_get_GCPY(GCP gcp)
|
static double |
GDAL_GCP_get_GCPZ(GCP gcp)
|
static String |
GDAL_GCP_get_Id(GCP gcp)
|
static String |
GDAL_GCP_get_Info(GCP gcp)
|
static String |
GDAL_GCP_Id_get(GCP gcp)
|
static void |
GDAL_GCP_Id_set(GCP gcp,
String pszId)
|
static String |
GDAL_GCP_Info_get(GCP gcp)
|
static void |
GDAL_GCP_Info_set(GCP gcp,
String pszInfo)
|
static void |
GDAL_GCP_set_GCPLine(GCP gcp,
double dfGCPLine)
|
static void |
GDAL_GCP_set_GCPPixel(GCP gcp,
double dfGCPPixel)
|
static void |
GDAL_GCP_set_GCPX(GCP gcp,
double dfGCPX)
|
static void |
GDAL_GCP_set_GCPY(GCP gcp,
double dfGCPY)
|
static void |
GDAL_GCP_set_GCPZ(GCP gcp,
double dfGCPZ)
|
static void |
GDAL_GCP_set_Id(GCP gcp,
String pszId)
|
static void |
GDAL_GCP_set_Info(GCP gcp,
String pszInfo)
|
static void |
GDALDestroyDriverManager()
|
static String[] |
GeneralCmdLineProcessor(String[] args)
General utility option processing. |
static String[] |
GeneralCmdLineProcessor(String[] args,
int options)
General utility option processing. |
static Vector |
GeneralCmdLineProcessor(Vector args)
General utility option processing. |
static Vector |
GeneralCmdLineProcessor(Vector args,
int options)
General utility option processing. |
static int |
GetCacheMax()
Get maximum cache memory. |
static int |
GetCacheUsed()
Get cache memory used. |
static String |
GetColorInterpretationName(int eColorInterp)
Get name of color interpretation. |
static String |
GetConfigOption(String key)
Get the value of a configuration option. |
static String |
GetConfigOption(String key,
String defaultValue)
Get the value of a configuration option. |
static int |
GetDataTypeByName(String dataTypeName)
Get data type by symbolic name. |
static String |
GetDataTypeName(int eDataType)
Get name of data type. |
static int |
GetDataTypeSize(int eDataType)
Get data type size in bits. |
static Driver |
GetDriver(int iDriver)
Fetch driver by index. |
static Driver |
GetDriverByName(String name)
Fetch a driver based on the short name. |
static int |
GetDriverCount()
Fetch the number of registered drivers. |
static String |
GetLastErrorMsg()
Get the last error message. |
static int |
GetLastErrorNo()
Fetch the last error number. |
static int |
GetLastErrorType()
Fetch the last error type. |
static String |
GetPaletteInterpretationName(int ePaletteInterp)
Get name of palette interpretation. |
static Driver |
IdentifyDriver(String name)
Identify the driver that can open a raster file. |
static Driver |
IdentifyDriver(String name,
Vector fileList)
Identify the driver that can open a raster file. |
static double[] |
InvGeoTransform(double[] gt_in)
Invert Geotransform. |
static int |
InvGeoTransform(double[] gt_in,
double[] gt_out)
Invert Geotransform. |
static Dataset |
Open(String name)
Open a raster file as a Dataset object. |
static Dataset |
Open(String name,
int eAccess)
Open a raster file as a Dataset object. |
static Dataset |
OpenShared(String name)
Open a raster file as a Dataset object. |
static Dataset |
OpenShared(String name,
int eAccess)
Open a raster file as a GDALDataset. |
static double |
PackedDMSToDec(double dfPacked)
|
static XMLNode |
ParseXMLString(String xmlString)
Parse an XML string into tree form. |
static int |
Polygonize(Band srcBand,
Band maskBand,
Layer outLayer,
int iPixValField)
Create polygon coverage from raster data. |
static int |
Polygonize(Band srcBand,
Band maskBand,
Layer outLayer,
int iPixValField,
Vector options)
Create polygon coverage from raster data. |
static int |
Polygonize(Band srcBand,
Band maskBand,
Layer outLayer,
int iPixValField,
Vector options,
ProgressCallback callback)
Create polygon coverage from raster data. |
static void |
PopErrorHandler()
Pop error handler off stack. |
static void |
PopFinderLocation()
|
static int |
PushErrorHandler()
Push the quiet error handler. |
static int |
PushErrorHandler(String callbackName)
Push a new error handler. |
static void |
PushFinderLocation(String pszLocation)
|
static int |
RasterizeLayer(Dataset dataset,
int[] bandNumbers,
Layer layer)
Burn geometries from the specified layer into raster. |
static int |
RasterizeLayer(Dataset dataset,
int[] bandNumbers,
Layer layer,
double[] burn_values)
Burn geometries from the specified layer into raster. |
static int |
RasterizeLayer(Dataset dataset,
int[] bandNumbers,
Layer layer,
double[] burn_values,
Vector options)
Burn geometries from the specified layer into raster. |
static int |
RasterizeLayer(Dataset dataset,
int[] bandNumbers,
Layer layer,
double[] burn_values,
Vector options,
ProgressCallback callback)
Burn geometries from the specified layer into raster. |
static Vector |
ReadDir(String pszDirName)
|
static int |
RegenerateOverview(Band srcBand,
Band overviewBand)
Generate downsampled overview. |
static int |
RegenerateOverview(Band srcBand,
Band overviewBand,
String resampling)
Generate downsampled overview. |
static int |
RegenerateOverview(Band srcBand,
Band overviewBand,
String resampling,
ProgressCallback callback)
Generate downsampled overview. |
static int |
RegenerateOverviews(Band srcBand,
Band[] overviewBands)
Generate downsampled overviews. |
static int |
RegenerateOverviews(Band srcBand,
Band[] overviewBands,
String resampling)
Generate downsampled overviews. |
static int |
RegenerateOverviews(Band srcBand,
Band[] overviewBands,
String resampling,
ProgressCallback callback)
Generate downsampled overviews. |
static int |
ReprojectImage(Dataset src_ds,
Dataset dst_ds)
Reproject image. |
static int |
ReprojectImage(Dataset src_ds,
Dataset dst_ds,
String src_wkt)
Reproject image. |
static int |
ReprojectImage(Dataset src_ds,
Dataset dst_ds,
String src_wkt,
String dst_wkt)
Reproject image. |
static int |
ReprojectImage(Dataset src_ds,
Dataset dst_ds,
String src_wkt,
String dst_wkt,
int resampleAlg)
Reproject image. |
static int |
ReprojectImage(Dataset src_ds,
Dataset dst_ds,
String src_wkt,
String dst_wkt,
int resampleAlg,
double warpMemoryLimit)
Reproject image. |
static int |
ReprojectImage(Dataset src_ds,
Dataset dst_ds,
String src_wkt,
String dst_wkt,
int resampleAlg,
double warpMemoryLimit,
double maxError)
Reproject image. |
static int |
ReprojectImage(Dataset src_ds,
Dataset dst_ds,
String src_wkt,
String dst_wkt,
int resampleAlg,
double warpMemoryLimit,
double maxError,
ProgressCallback callback)
Reproject image. |
static String |
SerializeXMLTree(XMLNode xmlnode)
Convert tree into string document. |
static void |
SetCacheMax(int newSize)
Set maximum cache memory. |
static void |
SetConfigOption(String key,
String value)
Set a configuration option for GDAL/OGR use. |
static int |
SieveFilter(Band srcBand,
Band maskBand,
Band dstBand,
int threshold)
Removes small raster polygons. |
static int |
SieveFilter(Band srcBand,
Band maskBand,
Band dstBand,
int threshold,
int connectedness)
Removes small raster polygons. |
static int |
SieveFilter(Band srcBand,
Band maskBand,
Band dstBand,
int threshold,
int connectedness,
Vector options)
Removes small raster polygons. |
static int |
SieveFilter(Band srcBand,
Band maskBand,
Band dstBand,
int threshold,
int connectedness,
Vector options,
ProgressCallback callback)
Removes small raster polygons. |
static int |
Unlink(String fileName)
Delete a file. |
static String |
VersionInfo()
Get runtime version information. |
static String |
VersionInfo(String request)
Get runtime version information. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String[] GeneralCmdLineProcessor(String[] args, int options)
The typical usage looks something like the following. Note that the formats should be registered so that the --formats and --format options will work properly.
public static void main( Strings[] args ) { gdal.AllRegister(); args = gdal.GeneralCmdLineProcessor( args, 0 ); }
args
- the argument list arrayoptions
- currently unused
public static String[] GeneralCmdLineProcessor(String[] args)
GeneralCmdLineProcessor(String[] args, int options)
public static double[] InvGeoTransform(double[] gt_in)
gt_in
- Input geotransform (allocated array of six doubles - unaltered).
public static void Debug(String msg_class, String message)
Categories are usually an identifier for the subsystem producing the error. For instance "GDAL" might be used for the GDAL core, and "TIFF" for messages from the TIFF translator.
msg_class
- name of the debugging message category.message
- message to display.public static int PushErrorHandler(String callbackName)
callbackName
- handler function name : "CPLQuietErrorHandler", "CPLDefaultErrorHandler", "CPLLoggingErrorHandler"public static int PushErrorHandler()
public static void Error(int msg_class, int err_code, String msg)
The msg_class argument can have the value gdalconst.CE_Warning indicating that the message is an informational warning, gdalconst.CE_Failure indicating that the action failed, but that normal recover mechanisms will be used or CE_Fatal meaning that a fatal error has occured, and that Error() should not return. The default behaviour of Error() is to report errors to stderr, and to abort() after reporting a gdalconst.CE_Fatal error. It is expected that some applications will want to supress error reporting, and will want to install a C++ exception, or longjmp() approach to no local fatal error recovery. Regardless of how application error handlers or the default error handler choose to handle an error, the error number, and message will be stored for recovery with gdal.GetLastErrorNo() and gdal.GetLastErrorMsg().
msg_class
- one of gdalconst.CE_Warning, gdalconst.CE_Failure or gdalconst.CE_Fatal.err_code
- the error number (CPLE_*) from cpl_error.h.msg
- message to display..public static void PopErrorHandler()
public static void ErrorReset()
public static String EscapeString(byte[] byteArray, int scheme)
EscapeString(String str, int scheme)
public static String EscapeString(String str, int scheme)
str
- the string to escape.scheme
- the encoding scheme to use.
public static int GetLastErrorNo()
public static int GetLastErrorType()
public static String GetLastErrorMsg()
public static void PushFinderLocation(String pszLocation)
public static void PopFinderLocation()
public static void FinderClean()
public static String FindFile(String pszClass, String pszBasename)
public static Vector ReadDir(String pszDirName)
public static void SetConfigOption(String key, String value)
This mechanism is similar to environment variables, but options set with gdal.SetConfigOption() overrides, for gdal.GetConfigOption() point of view, values defined in the environment.
If gdal.SetConfigOption() is called several times with the same key, the value provided during the last call will be used.
Options can also be passed on the command line of most GDAL utilities with the with '--config KEY VALUE'. For example, ogrinfo --config CPL_DEBUG ON ~/data/test/point.shp
key
- the key of the optionvalue
- the value of the optionGetConfigOption(java.lang.String, java.lang.String)
public static String GetConfigOption(String key, String defaultValue)
key
- the key of the option to retrievedefaultValue
- a default value if the key does not match existing defined options (may be null)
SetConfigOption(java.lang.String, java.lang.String)
public static String GetConfigOption(String key)
GetConfigOption(String key, String defaultValue)
public static String CPLBinaryToHex(byte[] nBytes)
public static byte[] CPLHexToBinary(String pszHex)
public static void FileFromMemBuffer(String fileName, byte[] byteArray)
fileName
- filename (should begin with "/vsimem/")byteArray
- data buffer to put in the fileUnlink(String fileName)
public static int Unlink(String fileName)
fileName
- the path of the file to be deleted.
FileFromMemBuffer(String fileName, byte[] byteArray)
public static double GDAL_GCP_GCPX_get(GCP gcp)
public static void GDAL_GCP_GCPX_set(GCP gcp, double dfGCPX)
public static double GDAL_GCP_GCPY_get(GCP gcp)
public static void GDAL_GCP_GCPY_set(GCP gcp, double dfGCPY)
public static double GDAL_GCP_GCPZ_get(GCP gcp)
public static void GDAL_GCP_GCPZ_set(GCP gcp, double dfGCPZ)
public static double GDAL_GCP_GCPPixel_get(GCP gcp)
public static void GDAL_GCP_GCPPixel_set(GCP gcp, double dfGCPPixel)
public static double GDAL_GCP_GCPLine_get(GCP gcp)
public static void GDAL_GCP_GCPLine_set(GCP gcp, double dfGCPLine)
public static String GDAL_GCP_Info_get(GCP gcp)
public static void GDAL_GCP_Info_set(GCP gcp, String pszInfo)
public static String GDAL_GCP_Id_get(GCP gcp)
public static void GDAL_GCP_Id_set(GCP gcp, String pszId)
public static double GDAL_GCP_get_GCPX(GCP gcp)
public static void GDAL_GCP_set_GCPX(GCP gcp, double dfGCPX)
public static double GDAL_GCP_get_GCPY(GCP gcp)
public static void GDAL_GCP_set_GCPY(GCP gcp, double dfGCPY)
public static double GDAL_GCP_get_GCPZ(GCP gcp)
public static void GDAL_GCP_set_GCPZ(GCP gcp, double dfGCPZ)
public static double GDAL_GCP_get_GCPPixel(GCP gcp)
public static void GDAL_GCP_set_GCPPixel(GCP gcp, double dfGCPPixel)
public static double GDAL_GCP_get_GCPLine(GCP gcp)
public static void GDAL_GCP_set_GCPLine(GCP gcp, double dfGCPLine)
public static String GDAL_GCP_get_Info(GCP gcp)
public static void GDAL_GCP_set_Info(GCP gcp, String pszInfo)
public static String GDAL_GCP_get_Id(GCP gcp)
public static void GDAL_GCP_set_Id(GCP gcp, String pszId)
public static int GCPsToGeoTransform(GCP[] gcpArray, double[] outGeoTransform, int bApproxOK)
Due to imprecision in the calculations the fit algorithm will often return non-zero rotational coefficients even if given perfectly non-rotated inputs. A special case has been implemented for corner corner coordinates given in TL, TR, BR, BL order. So when using this to get a geotransform from 4 corner coordinates, pass them in this order.
gcpArray
- the array of GCP.outGeoTransform
- the six double array in which the affine
geotransformation will be returned.bApproxOK
- If 0 the function will fail if the geotransform is not
essentially an exact fit (within 0.25 pixel) for all GCPs.
public static int GCPsToGeoTransform(GCP[] gcpArray, double[] outGeoTransform)
GCPsToGeoTransform(GCP[] gcpArray, double[] outGeoTransform, int bApproxOK)
public static int ComputeMedianCutPCT(Band red, Band green, Band blue, int num_colors, ColorTable colors, ProgressCallback callback)
This code was based on the tiffmedian.c code from libtiff (www.libtiff.org) which was based on a paper by Paul Heckbert:
"Color Image Quantization for Frame Buffer Display", Paul Heckbert, SIGGRAPH proceedings, 1982, pp. 297-307.
The red, green and blue input bands do not necessarily need to come from the same file, but they must be the same width and height. They will be clipped to 8bit during reading, so non-eight bit bands are generally inappropriate.
red
- Red input band.green
- Green input band.blue
- Blue input band.num_colors
- the desired number of colors to be returned (2-256).colors
- the color table will be returned in this color table object.callback
- for reporting algorithm progress. May be null
public static int ComputeMedianCutPCT(Band red, Band green, Band blue, int num_colors, ColorTable colors)
ComputeMedianCutPCT(Band red, Band green, Band blue, int num_colors, ColorTable colors, ProgressCallback callback)
public static int DitherRGB2PCT(Band red, Band green, Band blue, Band target, ColorTable colors, ProgressCallback callback)
The red, green and blue input bands do not necessarily need to come from the same file, but they must be the same width and height. They will be clipped to 8bit during reading, so non-eight bit bands are generally inappropriate. Likewise the hTarget band will be written with 8bit values and must match the width and height of the source bands.
The color table cannot have more than 256 entries.
red
- Red input band.green
- Green input band.blue
- Blue input band.target
- Output band.colors
- the color table to use with the output band.callback
- for reporting algorithm progress. May be null
public static int DitherRGB2PCT(Band red, Band green, Band blue, Band target, ColorTable colors)
DitherRGB2PCT(Band red, Band green, Band blue, Band target, ColorTable colors, ProgressCallback callback)
public static int ReprojectImage(Dataset src_ds, Dataset dst_ds, String src_wkt, String dst_wkt, int resampleAlg, double warpMemoryLimit, double maxError, ProgressCallback callback)
By default all bands are transferred, with no masking or nodata values in effect. No metadata, projection info, or color tables are transferred to the output file.
src_ds
- the source image file.dst_ds
- the destination image file.src_wkt
- the source projection. If null the source projection
is read from from src_ds.dst_wkt
- the destination projection. If null the destination
projection will be read from dst_ds.resampleAlg
- the type of resampling to use. (among gdalconst.GRA_*)warpMemoryLimit
- the amount of memory (in bytes) that the warp
API is allowed to use for caching. This is in addition to the memory
already allocated to the GDAL caching (as per gdal.SetCacheMax()). May be
0.0 to use default memory settings.maxError
- maximum error measured in input pixels that is allowed
in approximating the transformation (0.0 for exact calculations).callback
- for reporting progress or null
public static int ReprojectImage(Dataset src_ds, Dataset dst_ds, String src_wkt, String dst_wkt, int resampleAlg, double warpMemoryLimit, double maxError)
ReprojectImage(Dataset src_ds, Dataset dst_ds, String src_wkt, String dst_wkt, int resampleAlg, double warpMemoryLimit, double maxError, ProgressCallback callback)
public static int ReprojectImage(Dataset src_ds, Dataset dst_ds, String src_wkt, String dst_wkt, int resampleAlg, double warpMemoryLimit)
ReprojectImage(Dataset src_ds, Dataset dst_ds, String src_wkt, String dst_wkt, int resampleAlg, double warpMemoryLimit, double maxError, ProgressCallback callback)
public static int ReprojectImage(Dataset src_ds, Dataset dst_ds, String src_wkt, String dst_wkt, int resampleAlg)
ReprojectImage(Dataset src_ds, Dataset dst_ds, String src_wkt, String dst_wkt, int resampleAlg, double warpMemoryLimit, double maxError, ProgressCallback callback)
public static int ReprojectImage(Dataset src_ds, Dataset dst_ds, String src_wkt, String dst_wkt)
ReprojectImage(Dataset src_ds, Dataset dst_ds, String src_wkt, String dst_wkt, int resampleAlg, double warpMemoryLimit, double maxError, ProgressCallback callback)
public static int ReprojectImage(Dataset src_ds, Dataset dst_ds, String src_wkt)
ReprojectImage(Dataset src_ds, Dataset dst_ds, String src_wkt, String dst_wkt, int resampleAlg, double warpMemoryLimit, double maxError, ProgressCallback callback)
public static int ReprojectImage(Dataset src_ds, Dataset dst_ds)
ReprojectImage(Dataset src_ds, Dataset dst_ds, String src_wkt, String dst_wkt, int resampleAlg, double warpMemoryLimit, double maxError, ProgressCallback callback)
public static int ComputeProximity(Band srcBand, Band proximityBand, Vector options, ProgressCallback callback)
Options:
srcBand
- the source bandproximityBand
- the destination bandoptions
- a vector of strings with the above optionscallback
- for reporting progress or null
public static int ComputeProximity(Band srcBand, Band proximityBand, Vector options)
ComputeProximity(Band srcBand, Band proximityBand, java.util.Vector options, ProgressCallback callback)
public static int ComputeProximity(Band srcBand, Band proximityBand)
ComputeProximity(Band srcBand, Band proximityBand, java.util.Vector options, ProgressCallback callback)
public static int RasterizeLayer(Dataset dataset, int[] bandNumbers, Layer layer, double[] burn_values, Vector options, ProgressCallback callback)
The transform needs to transform the geometry locations into pixel/line coordinates on the raster dataset.
The output raster may be of any GDAL supported datatype, though currently internally the burning is done either as gdal.GDT_Byte or gdal.GDT_Float32. This may be improved in the future. An explicit list of burn values for each layer for each band must be passed in.
dataset
- output data, must be opened in update mode.bandNumbers
- the list of bands to be updated.layer
- the layer to burn in.burn_values
- the array of values to burn into the raster.
There should be as many values as in bandNumbers. If null, 255 will be usedoptions
- a vector of strings for special options controlling rasterization:
callback
- for reporting progress or null
public static int RasterizeLayer(Dataset dataset, int[] bandNumbers, Layer layer, double[] burn_values, Vector options)
RasterizeLayer(Dataset dataset, int[] bandNumbers, org.gdal.ogr.Layer layer, double[] burn_values, java.util.Vector options, ProgressCallback callback)
public static int RasterizeLayer(Dataset dataset, int[] bandNumbers, Layer layer, double[] burn_values)
RasterizeLayer(Dataset dataset, int[] bandNumbers, org.gdal.ogr.Layer layer, double[] burn_values, java.util.Vector options, ProgressCallback callback)
public static int RasterizeLayer(Dataset dataset, int[] bandNumbers, Layer layer)
RasterizeLayer(Dataset dataset, int[] bandNumbers, org.gdal.ogr.Layer layer, double[] burn_values, java.util.Vector options, ProgressCallback callback)
public static int Polygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, Vector options, ProgressCallback callback)
Note that currently the source pixel band values are read into a signed 32bit integer buffer (Int32), so floating point or complex bands will be implicitly truncated before processing.
Polygon features will be created on the output layer, with polygon geometries representing the polygons. The polygon geometries will be in the georeferenced coordinate system of the image (based on the geotransform of the source dataset). It is acceptable for the output layer to already have features. Note that gdal.Polygonize() does not set the coordinate system on the output layer. Application code should do this when the layer is created, presumably matching the raster coordinate system.
The algorithm used attempts to minimize memory use so that very large rasters can be processed. However, if the raster has many polygons or very large/complex polygons, the memory use for holding polygon enumerations and active polygon geometries may grow to be quite large.
The algorithm will generally produce very dense polygon geometries, with edges that follow exactly on pixel boundaries for all non-interior pixels. For non-thematic raster data (such as satellite images) the result will essentially be one small polygon per pixel, and memory and output layer sizes will be substantial. The algorithm is primarily intended for relatively simple thematic imagery, masks, and classification results.
srcBand
- the source raster band to be processed.maskBand
- an optional mask band (or null). All pixels in the mask band with a
value other than zero will be considered suitable for collection as
polygons.outLayer
- the vector feature layer to which the polygons should
be written.iPixValField
- the attribute field index indicating the feature
attribute into which the pixel value of the polygon should be written.options
- a name/value list of additional options (none currently
supported. just pass null).callback
- for reporting progress or null
public static int Polygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, Vector options)
Polygonize(Band srcBand, Band maskBand, org.gdal.ogr.Layer outLayer, int iPixValField, java.util.Vector options, ProgressCallback callback)
public static int Polygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField)
Polygonize(Band srcBand, Band maskBand, org.gdal.ogr.Layer outLayer, int iPixValField, java.util.Vector options, ProgressCallback callback)
public static int FillNodata(Band targetBand, Band maskBand, double maxSearchDist, int smoothingIterations, Vector options, ProgressCallback callback)
This algorithm is generally suitable for interpolating missing regions of fairly continuously varying rasters (such as elevation models for instance). It is also suitable for filling small holes and cracks in more irregularly varying images (like airphotos). It is generally not so great for interpolating a raster from sparse point data - see the algorithms defined in gdal_grid.h for that case.
targetBand
- the raster band to be modified in place.maskBand
- a mask band indicating pixels to be interpolated (zero valuedmaxSearchDist
- the maximum number of pixels to search in all
directions to find values to interpolate from.smoothingIterations
- the number of 3x3 smoothing filter passes to
run (0 or more).options
- additional name=value options in a string list (none
supported at this time - just pass null).callback
- for reporting progress or null
public static int FillNodata(Band targetBand, Band maskBand, double maxSearchDist, int smoothingIterations, Vector options)
FillNodata(Band targetBand, Band maskBand, double maxSearchDist, int smoothingIterations, java.util.Vector options, ProgressCallback callback)
public static int FillNodata(Band targetBand, Band maskBand, double maxSearchDist, int smoothingIterations)
FillNodata(Band targetBand, Band maskBand, double maxSearchDist, int smoothingIterations, java.util.Vector options, ProgressCallback callback)
public static int SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness, Vector options, ProgressCallback callback)
Polygon are determined (per GDALRasterPolygonEnumerator) as regions of the raster where the pixels all have the same value, and that are contiguous (connected).
Pixels determined to be "nodata" per maskBand will not be treated as part of a polygon regardless of their pixel values. Nodata areas will never be changed nor affect polygon sizes.
Polygons smaller than the threshold with no neighbours that are as large as the threshold will not be altered. Polygons surrounded by nodata areas will therefore not be altered.
The algorithm makes three passes over the input file to enumerate the polygons and collect limited information about them. Memory use is proportional to the number of polygons (roughly 24 bytes per polygon), but is not directly related to the size of the raster. So very large raster files can be processed effectively if there aren't too many polygons. But extremely noisy rasters with many one pixel polygons will end up being expensive (in memory) to process.
srcBand
- the source raster band to be processed.maskBand
- an optional mask band. All pixels in the mask band with a
value other than zero will be considered suitable for inclusion in polygons.dstBand
- the output raster band. It may be the same as srcBand
to update the source in place.threshold
- raster polygons with sizes smaller than this will
be merged into their largest neighbour.connectedness
- either 4 indicating that diagonal pixels are not
considered directly adjacent for polygon membership purposes or 8
indicating they are.options
- algorithm options in name=value list form. None currently
supported. just pass nullcallback
- for reporting progress or null
public static int SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness, Vector options)
SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness, java.util.Vector options, ProgressCallback callback)
public static int SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness)
SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness, java.util.Vector options, ProgressCallback callback)
public static int SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold)
SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness, java.util.Vector options, ProgressCallback callback)
public static int RegenerateOverviews(Band srcBand, Band[] overviewBands, String resampling, ProgressCallback callback)
The output bands need to exist in advance.
The full set of resampling algorithms is documented in Dataset.BuildOverviews().
srcBand
- the source (base level) band.overviewBands
- the list of downsampled bands to be generated.resampling
- Resampling algorithm (eg. "AVERAGE").callback
- for reporting progress or null
Dataset.BuildOverviews(java.lang.String resampling, int[] overviewlist, ProgressCallback callback)
public static int RegenerateOverviews(Band srcBand, Band[] overviewBands, String resampling)
RegenerateOverviews(Band srcBand, Band[] overviewBands, String resampling, ProgressCallback callback)
public static int RegenerateOverviews(Band srcBand, Band[] overviewBands)
RegenerateOverviews(Band srcBand, Band[] overviewBands, String resampling, ProgressCallback callback)
public static int RegenerateOverview(Band srcBand, Band overviewBand, String resampling, ProgressCallback callback)
RegenerateOverviews(Band srcBand, Band[] overviewBands, String resampling, ProgressCallback callback)
public static int RegenerateOverview(Band srcBand, Band overviewBand, String resampling)
RegenerateOverviews(Band srcBand, Band[] overviewBands, String resampling, ProgressCallback callback)
public static int RegenerateOverview(Band srcBand, Band overviewBand)
RegenerateOverviews(Band srcBand, Band[] overviewBands, String resampling, ProgressCallback callback)
public static Dataset AutoCreateWarpedVRT(Dataset src_ds, String src_wkt, String dst_wkt, int eResampleAlg, double maxError)
Note that the constructed Dataset object will acquire one or more references to the passed in src_ds. Reference counting semantics on the source dataset should be honoured. That is, don't just GDALClose() it unless it was opened with GDALOpenShared().
The returned dataset will have no associated filename for itself. If you want to write the virtual dataset description to a file, use the SetDescription() method on the dataset to assign a filename before it is closed.
src_ds
- The source dataset.src_wkt
- The coordinate system of the source image. If null, it
will be read from the source image.dst_wkt
- The coordinate system to convert to. If null no change
of coordinate system will take place.eResampleAlg
- One of gdalconst.GRA_NearestNeighbour, gdalconst.GRA_Bilinear, gdalconst.GRA_Cubic or
gdalconst.RA_CubicSpline. Controls the sampling method used.maxError
- Maximum error measured in input pixels that is allowed in
approximating the transformation (0.0 for exact calculations).
public static Dataset AutoCreateWarpedVRT(Dataset src_ds, String src_wkt, String dst_wkt, int eResampleAlg)
AutoCreateWarpedVRT(Dataset src_ds, String src_wkt, String dst_wkt, int eResampleAlg, double maxError)
public static Dataset AutoCreateWarpedVRT(Dataset src_ds, String src_wkt, String dst_wkt)
AutoCreateWarpedVRT(Dataset src_ds, String src_wkt, String dst_wkt, int eResampleAlg, double maxError)
public static Dataset AutoCreateWarpedVRT(Dataset src_ds, String src_wkt)
AutoCreateWarpedVRT(Dataset src_ds, String src_wkt, String dst_wkt, int eResampleAlg, double maxError)
public static Dataset AutoCreateWarpedVRT(Dataset src_ds)
AutoCreateWarpedVRT(Dataset src_ds, String src_wkt, String dst_wkt, int eResampleAlg, double maxError)
public static void ApplyGeoTransform(double[] padfGeoTransform, double dfPixel, double dfLine, double[] pdfGeoX, double[] pdfGeoY)
pdfGeoX[0] = padfGeoTransform[0] + dfPixel * padfGeoTransform[1] + dfLine * padfGeoTransform[2]; pdfGeoY[0] = padfGeoTransform[3] + dfPixel * padfGeoTransform[4] + dfLine * padfGeoTransform[5];
padfGeoTransform
- Six coefficient GeoTransform to apply.dfPixel
- Input pixel positiondfLine
- Input line position.pdfGeoX
- allocated array of 1 double where geo_x (easting/longitude) location is placed.pdfGeoY
- allocated array of 1 double where geo_y (northing/latitude) location is placed.public static int InvGeoTransform(double[] gt_in, double[] gt_out)
gt_in
- Input geotransform (allocated array of six doubles - unaltered).gt_out
- Output geotransform (allocated array of six doubles - updated).
public static String VersionInfo(String request)
request
- the type of version info desired, as listed above.
public static String VersionInfo()
public static void AllRegister()
This function should generally be called once at the beginning of the application.
public static void GDALDestroyDriverManager()
public static int GetCacheMax()
public static void SetCacheMax(int newSize)
newSize
- the maximum number of bytes for caching. Maximum is 2GB.public static int GetCacheUsed()
public static int GetDataTypeSize(int eDataType)
eDataType
- type, such as gdalconst.GDT_Byte.
public static int DataTypeIsComplex(int eDataType)
public static String GetDataTypeName(int eDataType)
eDataType
- type to get name of.
public static int GetDataTypeByName(String dataTypeName)
dataTypeName
- string containing the symbolic name of the type.
public static String GetColorInterpretationName(int eColorInterp)
eColorInterp
- color interpretation to get name of.
public static String GetPaletteInterpretationName(int ePaletteInterp)
ePaletteInterp
- palette interpretation to get name of.
public static String DecToDMS(double dfAngle, String pszAxis, int nPrecision)
public static String DecToDMS(double dfAngle, String pszAxis)
public static double PackedDMSToDec(double dfPacked)
public static double DecToPackedDMS(double dfDec)
public static XMLNode ParseXMLString(String xmlString)
xmlString
- the document to parse.
public static String SerializeXMLTree(XMLNode xmlnode)
xmlnode
- the root of the tree to serialize
public static int GetDriverCount()
public static Driver GetDriverByName(String name)
name
- the short name, such as "GTiff", being searched for.
public static Driver GetDriver(int iDriver)
iDriver
- the driver index from 0 to gdal.GetDriverCount()-1.
public static Dataset Open(String name, int eAccess)
It is required that you explicitely close a dataset opened in update mode with the Dataset.delete() method. Otherwise the data might not be flushed to the disk. Don't rely only on Java garbage collection.
name
- the name of the file to access. In the case of
exotic drivers this may not refer to a physical file, but instead contain
information for the driver on how to access a dataset.eAccess
- the desired access, either gdalconst.GA_Update or gdalconst.GA_ReadOnly. Many
drivers support only read only access.
OpenShared(String name, int eAccess)
public static Dataset Open(String name)
Open(String name, int eAccess)
public static Dataset OpenShared(String name, int eAccess)
In particular, gdal.OpenShared() will first consult it's list of currently open and shared Dataset's, and if the GetDescription() name for one exactly matches the name passed to gdal.OpenShared() it will be referenced and returned.
name
- the name of the file to access. In the case of
exotic drivers this may not refer to a physical file, but instead contain
information for the driver on how to access a dataset.eAccess
- the desired access, either gdalconst.GA_Update or gdalconst.GA_ReadOnly. Many
drivers support only read only access.
Open(String name, int eAccess)
public static Dataset OpenShared(String name)
OpenShared(String name, int eAccess)
public static Driver IdentifyDriver(String name, Vector fileList)
In order to reduce the need for such searches touch the operating system file system machinery, it is possible to give an optional list of files. This is the list of all files at the same level in the file system as the target file, including the target file. The filenames will not include any path components, are an essentially just the output of CPLReadDir() on the parent directory. If the target object does not have filesystem semantics then the file list should be null.
name
- the name of the file to access. In the case of
exotic drivers this may not refer to a physical file, but instead contain
information for the driver on how to access a dataset.fileList
- a veector of strings.
These strings are filenames that are auxiliary to the main filename. The passed
value may be null.
public static Driver IdentifyDriver(String name)
IdentifyDriver(String name, java.util.Vector fileList)
public static Vector GeneralCmdLineProcessor(Vector args, int options)
GeneralCmdLineProcessor(String[] args, int options)
public static Vector GeneralCmdLineProcessor(Vector args)
GeneralCmdLineProcessor(String[] args, int options)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |