Package org.gdal.gdal

Class gdal


  • public class gdal
    extends java.lang.Object
    Class gdal is an uninstanciable class providing various utility functions as static methods.

    In particular, it provides :

    • gdal.AllRegister() and gdal.Open() methods.
    • bindings for various GDAL algorithms.
    • bindings for some general purpose CPL functions.
    • Method Detail

      • UseExceptions

        public static void UseExceptions()
      • DontUseExceptions

        public static void DontUseExceptions()
      • GetUseExceptions

        public static boolean GetUseExceptions()
      • GeneralCmdLineProcessor

        public static java.lang.String[] GeneralCmdLineProcessor​(java.lang.String[] args,
                                                                 int options)
        General utility option processing. This function is intended to provide a variety of generic commandline options for all GDAL commandline utilities. It takes care of the following commandline options:

        • --version: report version of GDAL in use.
        • --license: report GDAL license info.
        • --formats: report all format drivers configured.
        • --format [format]: report details of one format driver.
        • --optfile filename: expand an option file into the argument list.
        • --config key value: set system configuration option.
        • --debug [on/off/value]: set debug level.
        • --mempreload dir: preload directory contents into /vsimem
        • --help-general: report detailed help on general 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 );
          }
         
        Parameters:
        args - the argument list array
        options - currently unused
        Returns:
        updated argument list array.
        Since:
        Java bindings 1.7.0
      • GeneralCmdLineProcessor

        public static java.lang.String[] GeneralCmdLineProcessor​(java.lang.String[] args)
        General utility option processing. Same as below with options == 0
        Since:
        Java bindings 1.7.0
        See Also:
        GeneralCmdLineProcessor(String[] args, int options)
      • InvGeoTransform

        public static double[] InvGeoTransform​(double[] gt_in)
        Invert Geotransform.

        This function will invert a standard 3x2 set of GeoTransform coefficients. This converts the equation from being pixel to geo to being geo to pixel.

        Parameters:
        gt_in - Input geotransform (allocated array of six doubles - unaltered).
        Returns:
        an array of six doubles with the inverted geotransform on success or null if the equation is uninvertable.
        Since:
        Java bindings 1.7.0
      • Debug

        public static void Debug​(java.lang.String msg_class,
                                 java.lang.String message)
        Display a debugging message. The category argument is used in conjunction with the CPL_DEBUG environment variable to establish if the message should be displayed. If the CPL_DEBUG environment variable is not set, no debug messages are emitted (use Error(gdalconst.CE_Warning,...) to ensure messages are displayed). If CPL_DEBUG is set, but is an empty string or the word "ON" then all debug messages are shown. Otherwise only messages whose category appears somewhere within the CPL_DEBUG value are displayed (as determined by strstr()).

        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.

        Parameters:
        msg_class - name of the debugging message category.
        message - message to display.
      • SetErrorHandler

        public static int SetErrorHandler()
        Set a quiet global error handler. This installs a quiet global error handler. Note; if a local handler is already installed with PushErrorHandler(), the global error handler will not be used until the last local handler is uninstalled with PopErrorHandler().
        Since:
        Java bindings 1.10.0
      • SetCurrentErrorHandlerCatchDebug

        public static void SetCurrentErrorHandlerCatchDebug​(int bCatchDebug)
      • PushErrorHandler

        public static int PushErrorHandler​(java.lang.String callbackName)
        Push a new error handler. This pushes a new error handler on the thread-local error handler stack. This handler will be used until removed with gdal.PopErrorHandler().
        Parameters:
        callbackName - handler function name : "CPLQuietErrorHandler", "CPLDefaultErrorHandler", "CPLLoggingErrorHandler"
      • PushErrorHandler

        public static int PushErrorHandler()
        Push the quiet error handler. This pushes a new error handler on the thread-local error handler stack. This handler will be used until removed with gdal.PopErrorHandler().
        Since:
        Java bindings 1.7.0
      • Error

        public static void Error​(int msg_class,
                                 int err_code,
                                 java.lang.String msg)
        Report an error. This function reports an error in a manner that can be hooked and reported appropriate by different applications.

        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 occurred, and that Error() should not return.

        The default behavior 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 suppress 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().

        Parameters:
        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..
      • GOA2GetAuthorizationURL

        public static java.lang.String GOA2GetAuthorizationURL​(java.lang.String pszScope)
      • GOA2GetRefreshToken

        public static java.lang.String GOA2GetRefreshToken​(java.lang.String pszAuthToken,
                                                           java.lang.String pszScope)
      • GOA2GetAccessToken

        public static java.lang.String GOA2GetAccessToken​(java.lang.String pszRefreshToken,
                                                          java.lang.String pszScope)
      • PopErrorHandler

        public static void PopErrorHandler()
        Pop error handler off stack.

        Discards the current error handler on the error handler stack, and restores the one in use before the last gdal.PushErrorHandler() call. This method has no effect if there are no error handlers on the current threads error handler stack.

      • ErrorReset

        public static void ErrorReset()
        Erase any traces of previous errors.

        This is normally used to ensure that an error which has been recovered from does not appear to be still in play with high level functions.

      • EscapeString

        public static java.lang.String EscapeString​(byte[] byteArray,
                                                    int scheme)
        Apply escaping to string to preserve special characters.
        Since:
        Java bindings 1.7.0
        See Also:
        EscapeString(String str, int scheme)
      • EscapeString

        public static java.lang.String EscapeString​(java.lang.String str,
                                                    int scheme)
        Apply escaping to string to preserve special characters. This function will "escape" a variety of special characters to make the string suitable to embed within a string constant or to write within a text stream but in a form that can be reconstituted to it's original form. The escaping will even preserve zero bytes allowing preservation of raw binary data.
        • gdalconst.CPLES_BackslashQuotable(0): This scheme turns a binary string into a form suitable to be placed within double quotes as a string constant. The backslash, quote, '\\0' and newline characters are all escaped in the usual C style.
        • gdalconst.CPLES_XML(1): This scheme converts the '<', '>' and '&' characters into their XML/HTML equivalent (&gt;, &lt; and &amp;) making a string safe to embed as CDATA within an XML element. The '\\0' is not escaped and should not be included in the input.
        • gdalconst.CPLES_URL(2): Everything except alphanumerics and the underscore are converted to a percent followed by a two digit hex encoding of the character (leading zero supplied if needed). This is the mechanism used for encoding values to be passed in URLs.
        • gdalconst.CPLES_SQL(3): All single quotes are replaced with two single quotes. Suitable for use when constructing literal values for SQL commands where the literal will be enclosed in single quotes.
        • gdalconst.CPLES_CSV(4): If the values contains commas, double quotes, or newlines it placed in double quotes, and double quotes in the value are doubled. Suitable for use when constructing field values for .csv files. Note that gdal.UnescapeString() currently does not support this format, only gdal.EscapeString(). See cpl_csv.cpp for csv parsing support.
        Parameters:
        str - the string to escape.
        scheme - the encoding scheme to use.
        Returns:
        an escaped string
        Since:
        Java bindings 1.7.0
      • GetLastErrorNo

        public static int GetLastErrorNo()
        Fetch the last error number.

        This is the error number, not the error class.

        Returns:
        the error number of the last error to occur, or gdalconst.CPLE_None (0) if there are no posted errors.
      • GetLastErrorType

        public static int GetLastErrorType()
        Fetch the last error type.

        This is the error class, not the error number.

        Returns:
        the error number of the last error to occur, or gdalconst.CE_None (0) if there are no posted errors.
      • GetLastErrorMsg

        public static java.lang.String GetLastErrorMsg()
        Get the last error message.

        Fetches the last error message posted with CPLError(), that hasn't been cleared by gdal.ErrorReset().

        Returns:
        the last error message, or null if there is no posted error message.
      • GetErrorCounter

        public static long GetErrorCounter()
      • VSIGetLastErrorNo

        public static int VSIGetLastErrorNo()
      • VSIGetLastErrorMsg

        public static java.lang.String VSIGetLastErrorMsg()
      • VSIErrorReset

        public static void VSIErrorReset()
      • PushFinderLocation

        public static void PushFinderLocation​(java.lang.String utf8_path)
      • PopFinderLocation

        public static void PopFinderLocation()
      • FinderClean

        public static void FinderClean()
      • FindFile

        public static java.lang.String FindFile​(java.lang.String pszClass,
                                                java.lang.String utf8_path)
      • ReadDir

        public static java.util.Vector ReadDir​(java.lang.String utf8_path,
                                               int nMaxFiles)
      • ReadDir

        public static java.util.Vector ReadDir​(java.lang.String path)
        Read names in a directory.

        This function abstracts access to directory contains. It returns a list of strings containing the names of files, and directories in this directory.

        Note that no error is issued via CPLError() if the directory path is invalid, though null is returned.

        Parameters:
        path - the relative, or absolute path of a directory to read.
        Returns:
        The list of entries in the directory, or null if the directory doesn't exist.
        Since:
        Java bindings 1.7.0
      • ReadDirRecursive

        public static java.util.Vector ReadDirRecursive​(java.lang.String utf8_path)
      • SetConfigOption

        public static void SetConfigOption​(java.lang.String key,
                                           java.lang.String value)
        Set a configuration option for GDAL/OGR use.

        Those options are defined as a (key, value) couple. The value corresponding to a key can be got later with the gdal.GetConfigOption() method.

        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

        Parameters:
        key - the key of the option
        value - the value of the option
        See Also:
        GetConfigOption(java.lang.String, java.lang.String)
      • SetThreadLocalConfigOption

        public static void SetThreadLocalConfigOption​(java.lang.String pszKey,
                                                      java.lang.String pszValue)
      • GetConfigOption

        public static java.lang.String GetConfigOption​(java.lang.String key,
                                                       java.lang.String defaultValue)
        Get the value of a configuration option.

        The value is the value of a (key, value) option set with gdal.SetConfigOption(). If the given option was no defined with gdal.SetConfigOption(), it tries to find it in environment variables.

        Parameters:
        key - the key of the option to retrieve
        defaultValue - a default value if the key does not match existing defined options (may be null)
        Returns:
        the value associated to the key, or the default value if not found
        See Also:
        SetConfigOption(java.lang.String, java.lang.String)
      • GetConfigOption

        public static java.lang.String GetConfigOption​(java.lang.String key)
        Get the value of a configuration option.

        Same as below with defaultValue == null

        Since:
        Java bindings 1.7.0
        See Also:
        GetConfigOption(String key, String defaultValue)
      • GetThreadLocalConfigOption

        public static java.lang.String GetThreadLocalConfigOption​(java.lang.String pszKey,
                                                                  java.lang.String pszDefault)
      • GetThreadLocalConfigOption

        public static java.lang.String GetThreadLocalConfigOption​(java.lang.String pszKey)
      • CPLBinaryToHex

        public static java.lang.String CPLBinaryToHex​(byte[] nBytes)
      • CPLHexToBinary

        public static byte[] CPLHexToBinary​(java.lang.String pszHex)
      • FileFromMemBuffer

        public static void FileFromMemBuffer​(java.lang.String fileName,
                                             byte[] byteArray)
        Create memory "file" from a buffer. A virtual memory file is created from the passed buffer with the indicated filename. Under normal conditions the filename would need to be absolute and within the /vsimem/ portion of the filesystem.

        The filename then can be used with GDAL and OGR drivers that uses the virtual file API.

        To free the memory associated with the file, you must use Unlink(fileName), otherwise memory leaks will occur.

        Parameters:
        fileName - filename (should begin with "/vsimem/")
        byteArray - data buffer to put in the file
        Since:
        Java bindings 1.7.0
        See Also:
        Unlink(String fileName)
      • Unlink

        public static int Unlink​(java.lang.String fileName)
        Delete a file.

        Deletes a file object from the file system. This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.

        Analog of the POSIX unlink() function.

        Parameters:
        fileName - the path of the file to be deleted.
        Returns:
        0 on success or -1 on an error.
        Since:
        Java bindings 1.7.0
        See Also:
        FileFromMemBuffer(String fileName, byte[] byteArray)
      • UnlinkBatch

        public static boolean UnlinkBatch​(java.util.Vector files)
      • Mkdir

        public static int Mkdir​(java.lang.String path,
                                int mode)
        Create a directory.

        Create a new directory with the indicated mode. The mode is ignored on some platforms. A reasonable default mode value would be 0666. This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.

        Analog of the POSIX mkdir() function.

        Parameters:
        path - the path to the directory to create.
        mode - the permissions mode.
        Returns:
        0 on success or -1 on an error.
        Since:
        Java bindings 1.8.0
      • Rmdir

        public static int Rmdir​(java.lang.String path)
        Delete a directory.

        Deletes a directory object from the file system. On some systems the directory must be empty before it can be deleted.

        This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.

        Analog of the POSIX rmdir() function.

        Parameters:
        path - the path of the directory to be deleted.
        Returns:
        0 on success or -1 on an error.
        Since:
        Java bindings 1.8.0
      • MkdirRecursive

        public static int MkdirRecursive​(java.lang.String utf8_path,
                                         int mode)
      • RmdirRecursive

        public static int RmdirRecursive​(java.lang.String utf8_path)
      • Rename

        public static int Rename​(java.lang.String oldpath,
                                 java.lang.String newpath)
        Rename a file.

        Renames a file object in the file system. It should be possible to rename a file onto a new filesystem, but it is safest if this function is only used to rename files that remain in the same directory.

        This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.

        Analog of the POSIX rename() function.

        Parameters:
        oldpath - the name of the file to be renamed.
        newpath - the name the file should be given.
        Returns:
        0 on success or -1 on an error.
        Since:
        Java bindings 1.8.0
      • GetActualURL

        public static java.lang.String GetActualURL​(java.lang.String utf8_path)
      • GetSignedURL

        public static java.lang.String GetSignedURL​(java.lang.String utf8_path,
                                                    java.util.Vector options)
      • GetSignedURL

        public static java.lang.String GetSignedURL​(java.lang.String utf8_path)
      • GetFileSystemsPrefixes

        public static java.util.Vector GetFileSystemsPrefixes()
      • GetFileSystemOptions

        public static java.lang.String GetFileSystemOptions​(java.lang.String utf8_path)
      • ParseCommandLine

        public static java.util.Vector ParseCommandLine​(java.lang.String utf8_path)
      • GDAL_GCP_GCPX_get

        public static double GDAL_GCP_GCPX_get​(GCP gcp)
      • GDAL_GCP_GCPX_set

        public static void GDAL_GCP_GCPX_set​(GCP gcp,
                                             double dfGCPX)
      • GDAL_GCP_GCPY_get

        public static double GDAL_GCP_GCPY_get​(GCP gcp)
      • GDAL_GCP_GCPY_set

        public static void GDAL_GCP_GCPY_set​(GCP gcp,
                                             double dfGCPY)
      • GDAL_GCP_GCPZ_get

        public static double GDAL_GCP_GCPZ_get​(GCP gcp)
      • GDAL_GCP_GCPZ_set

        public static void GDAL_GCP_GCPZ_set​(GCP gcp,
                                             double dfGCPZ)
      • GDAL_GCP_GCPPixel_get

        public static double GDAL_GCP_GCPPixel_get​(GCP gcp)
      • GDAL_GCP_GCPPixel_set

        public static void GDAL_GCP_GCPPixel_set​(GCP gcp,
                                                 double dfGCPPixel)
      • GDAL_GCP_GCPLine_get

        public static double GDAL_GCP_GCPLine_get​(GCP gcp)
      • GDAL_GCP_GCPLine_set

        public static void GDAL_GCP_GCPLine_set​(GCP gcp,
                                                double dfGCPLine)
      • GDAL_GCP_Info_get

        public static java.lang.String GDAL_GCP_Info_get​(GCP gcp)
      • GDAL_GCP_Info_set

        public static void GDAL_GCP_Info_set​(GCP gcp,
                                             java.lang.String pszInfo)
      • GDAL_GCP_Id_get

        public static java.lang.String GDAL_GCP_Id_get​(GCP gcp)
      • GDAL_GCP_Id_set

        public static void GDAL_GCP_Id_set​(GCP gcp,
                                           java.lang.String pszId)
      • GCPsToGeoTransform

        public static int GCPsToGeoTransform​(GCP[] gcpArray,
                                             double[] outGeoTransform,
                                             int bApproxOK)
        Generate Geotransform from GCPs.

        Given a set of GCPs perform first order fit as a geotransform.

        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.

        Parameters:
        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.
        Returns:
        1 on success or 0 if there aren't enough points to prepare a geotransform, the pointers are ill-determined or if bApproxOK is 0 and the fit is poor.
        Since:
        Java bindings 1.7.0
      • ComputeMedianCutPCT

        public static int ComputeMedianCutPCT​(Band red,
                                              Band green,
                                              Band blue,
                                              int num_colors,
                                              ColorTable colors,
                                              ProgressCallback callback)
        Compute optimal PCT for RGB image.

        This function implements a median cut algorithm to compute an "optimal" pseudocolor table for representing an input RGB image. This PCT could then be used with GDALDitherRGB2PCT() to convert a 24bit RGB image into an eightbit pseudo-colored image.

        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.

        Parameters:
        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
        Returns:
        returns gdalconst.CE_None on success or gdalconst.CE_Failure if an error occurs.
        Since:
        Java bindings 1.7.0
      • DitherRGB2PCT

        public static int DitherRGB2PCT​(Band red,
                                        Band green,
                                        Band blue,
                                        Band target,
                                        ColorTable colors,
                                        ProgressCallback callback)
        24bit to 8bit conversion with dithering.

        This functions utilizes Floyd-Steinberg dithering in the process of converting a 24bit RGB image into a pseudocolored 8bit image using a provided color table.

        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.

        Parameters:
        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
        Returns:
        gdalconst.CE_None on success or gdalconst.CE_Failure if an error occurs.
        Since:
        Java bindings 1.7.0
      • ReprojectImage

        public static int ReprojectImage​(Dataset src_ds,
                                         Dataset dst_ds,
                                         java.lang.String src_wkt,
                                         java.lang.String dst_wkt,
                                         int eResampleAlg,
                                         double WarpMemoryLimit,
                                         double maxerror,
                                         ProgressCallback callback,
                                         java.util.Vector options)
      • ReprojectImage

        public static int ReprojectImage​(Dataset src_ds,
                                         Dataset dst_ds,
                                         java.lang.String src_wkt,
                                         java.lang.String dst_wkt,
                                         int resampleAlg,
                                         double warpMemoryLimit,
                                         double maxError,
                                         ProgressCallback callback)
        Reproject image.

        This is a convenience function utilizing the GDALWarpOperation class to reproject an image from a source to a destination. In particular, this function takes care of establishing the transformation function to implement the reprojection, and will default a variety of other warp options.

        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.

        Parameters:
        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
        Returns:
        gdalconst.CE_None on success or gdalconst.CE_Failure if something goes wrong.
        Since:
        Java bindings 1.7.0
      • ComputeProximity

        public static int ComputeProximity​(Band srcBand,
                                           Band proximityBand,
                                           java.util.Vector options,
                                           ProgressCallback callback)
        Compute the proximity of all pixels in the image to a set of pixels in the source image.

        The following options are used to define the behavior of the function. By default all non-zero pixels in srcBand will be considered the "target", and all proximities will be computed in pixels. Note that target pixels are set to the value corresponding to a distance of zero.

        Options:

        VALUES=n[,n]*
        A list of target pixel values to measure the distance from. If this option is not provided proximity will be computed from non-zero pixel values. Currently pixel values are internally processed as integers.
        DISTUNITS=[PIXEL]/GEO
        Indicates whether distances will be computed in pixel units or in georeferenced units. The default is pixel units. This also determines the interpretation of MAXDIST.
        MAXDIST=n
        The maximum distance to search. Proximity distances greater than this value will not be computed. Instead output pixels will be set to a nodata value.
        NODATA=n
        The NODATA value to use on the output band for pixels that are beyond MAXDIST. If not provided, the hProximityBand will be queried for a nodata value. If one is not found, 65535 will be used.
        FIXED_BUF_VAL=n
        If this option is set, all pixels within the MAXDIST threadhold are set to this fixed value instead of to a proximity distance.
        Parameters:
        srcBand - the source band
        proximityBand - the destination band
        options - a vector of strings with the above options
        callback - for reporting progress or null
        Returns:
        gdalconst.CE_None on success or gdalconst.CE_Failure if something goes wrong.
        Since:
        Java bindings 1.7.0
      • RasterizeLayer

        public static int RasterizeLayer​(Dataset dataset,
                                         int[] bands,
                                         Layer layer,
                                         double[] burn_values,
                                         java.util.Vector options,
                                         ProgressCallback callback)
      • RasterizeLayer

        public static int RasterizeLayer​(Dataset dataset,
                                         int[] bands,
                                         Layer layer,
                                         double[] burn_values,
                                         java.util.Vector options)
      • RasterizeLayer

        public static int RasterizeLayer​(Dataset dataset,
                                         int[] bands,
                                         Layer layer,
                                         double[] burn_values)
      • RasterizeLayer

        public static int RasterizeLayer​(Dataset dataset,
                                         int[] bands,
                                         Layer layer)
      • Polygonize

        public static int Polygonize​(Band srcBand,
                                     Band maskBand,
                                     Layer outLayer,
                                     int iPixValField,
                                     java.util.Vector options,
                                     ProgressCallback callback)
      • Polygonize

        public static int Polygonize​(Band srcBand,
                                     Band maskBand,
                                     Layer outLayer,
                                     int iPixValField,
                                     java.util.Vector options)
      • Polygonize

        public static int Polygonize​(Band srcBand,
                                     Band maskBand,
                                     Layer outLayer,
                                     int iPixValField)
      • FPolygonize

        public static int FPolygonize​(Band srcBand,
                                      Band maskBand,
                                      Layer outLayer,
                                      int iPixValField,
                                      java.util.Vector options,
                                      ProgressCallback callback)
      • FPolygonize

        public static int FPolygonize​(Band srcBand,
                                      Band maskBand,
                                      Layer outLayer,
                                      int iPixValField,
                                      java.util.Vector options)
      • FPolygonize

        public static int FPolygonize​(Band srcBand,
                                      Band maskBand,
                                      Layer outLayer,
                                      int iPixValField)
      • FillNodata

        public static int FillNodata​(Band targetBand,
                                     Band maskBand,
                                     double maxSearchDist,
                                     int smoothingIterations,
                                     java.util.Vector options,
                                     ProgressCallback callback)
        Fill selected raster regions by interpolation from the edges.

        This algorithm will interpolate values for all designated nodata pixels (marked by zeros in maskBand). For each pixel a four direction conic search is done to find values to interpolate from (using inverse distance weighting). Once all values are interpolated, zero or more smoothing iterations (3x3 average filters on interpolated pixels) are applied to smooth out artifacts.

        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.

        Parameters:
        targetBand - the raster band to be modified in place.
        maskBand - a mask band indicating pixels to be interpolated (zero valued
        maxSearchDist - 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
        Returns:
        gdalconst.CE_None on success or gdalconst.CE_Failure on a failure.
        Since:
        Java bindings 1.7.0
      • SieveFilter

        public static int SieveFilter​(Band srcBand,
                                      Band maskBand,
                                      Band dstBand,
                                      int threshold,
                                      int connectedness,
                                      java.util.Vector options,
                                      ProgressCallback callback)
        Removes small raster polygons.

        The function removes raster polygons smaller than a provided threshold size (in pixels) and replaces them with the pixel value of the largest neighbour polygon.

        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.

        Parameters:
        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 null
        callback - for reporting progress or null
        Returns:
        gdalconst.CE_None on success or gdalconst.CE_Failure on a failure.
        Since:
        Java bindings 1.7.0
      • RegenerateOverviews

        public static int RegenerateOverviews​(Band srcBand,
                                              Band[] overviewBands,
                                              java.lang.String resampling,
                                              ProgressCallback callback)
        Generate downsampled overviews.

        This function will generate one or more overview images from a base image using the requested downsampling algorithm. It's primary use is for generating overviews via Dataset.BuildOverviews(), but it can also be used to generate downsampled images in one file from another outside the overview architecture.

        The output bands need to exist in advance.

        The full set of resampling algorithms is documented in Dataset.BuildOverviews().

        Parameters:
        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
        Returns:
        gdalconst.CE_None on success or gdalconst.CE_Failure on a failure.
        Since:
        Java bindings 1.7.0
        See Also:
        Dataset.BuildOverviews(java.lang.String resampling, int[] overviewlist, ProgressCallback callback)
      • GridCreate

        public static int GridCreate​(java.lang.String algorithmOptions,
                                     double[][] points,
                                     double xMin,
                                     double xMax,
                                     double yMin,
                                     double yMax,
                                     int xSize,
                                     int ySize,
                                     int dataType,
                                     java.nio.ByteBuffer nioBuffer,
                                     ProgressCallback callback)
      • GridCreate

        public static int GridCreate​(java.lang.String algorithmOptions,
                                     double[][] points,
                                     double xMin,
                                     double xMax,
                                     double yMin,
                                     double yMax,
                                     int xSize,
                                     int ySize,
                                     int dataType,
                                     java.nio.ByteBuffer nioBuffer)
      • ContourGenerate

        public static int ContourGenerate​(Band srcBand,
                                          double contourInterval,
                                          double contourBase,
                                          double[] fixedLevelCount,
                                          int useNoData,
                                          double noDataValue,
                                          Layer dstLayer,
                                          int idField,
                                          int elevField,
                                          ProgressCallback callback)
      • ContourGenerate

        public static int ContourGenerate​(Band srcBand,
                                          double contourInterval,
                                          double contourBase,
                                          double[] fixedLevelCount,
                                          int useNoData,
                                          double noDataValue,
                                          Layer dstLayer,
                                          int idField,
                                          int elevField)
      • ContourGenerateEx

        public static int ContourGenerateEx​(Band srcBand,
                                            Layer dstLayer,
                                            java.util.Vector options,
                                            ProgressCallback callback)
      • ContourGenerateEx

        public static int ContourGenerateEx​(Band srcBand,
                                            Layer dstLayer,
                                            java.util.Vector options)
      • ContourGenerateEx

        public static int ContourGenerateEx​(Band srcBand,
                                            Layer dstLayer)
      • ViewshedGenerate

        public static Dataset ViewshedGenerate​(Band srcBand,
                                               java.lang.String driverName,
                                               java.lang.String targetRasterName,
                                               SWIGTYPE_p_p_char creationOptions,
                                               double observerX,
                                               double observerY,
                                               double observerHeight,
                                               double targetHeight,
                                               double visibleVal,
                                               double invisibleVal,
                                               double outOfRangeVal,
                                               double noDataVal,
                                               double dfCurvCoeff,
                                               ViewshedMode mode,
                                               double maxDistance,
                                               ProgressCallback callback,
                                               ViewshedOutputType heightMode,
                                               SWIGTYPE_p_p_char papszOptions)
      • ViewshedGenerate

        public static Dataset ViewshedGenerate​(Band srcBand,
                                               java.lang.String driverName,
                                               java.lang.String targetRasterName,
                                               SWIGTYPE_p_p_char creationOptions,
                                               double observerX,
                                               double observerY,
                                               double observerHeight,
                                               double targetHeight,
                                               double visibleVal,
                                               double invisibleVal,
                                               double outOfRangeVal,
                                               double noDataVal,
                                               double dfCurvCoeff,
                                               ViewshedMode mode,
                                               double maxDistance,
                                               ProgressCallback callback,
                                               ViewshedOutputType heightMode)
      • ViewshedGenerate

        public static Dataset ViewshedGenerate​(Band srcBand,
                                               java.lang.String driverName,
                                               java.lang.String targetRasterName,
                                               SWIGTYPE_p_p_char creationOptions,
                                               double observerX,
                                               double observerY,
                                               double observerHeight,
                                               double targetHeight,
                                               double visibleVal,
                                               double invisibleVal,
                                               double outOfRangeVal,
                                               double noDataVal,
                                               double dfCurvCoeff,
                                               ViewshedMode mode,
                                               double maxDistance,
                                               ProgressCallback callback)
      • ViewshedGenerate

        public static Dataset ViewshedGenerate​(Band srcBand,
                                               java.lang.String driverName,
                                               java.lang.String targetRasterName,
                                               SWIGTYPE_p_p_char creationOptions,
                                               double observerX,
                                               double observerY,
                                               double observerHeight,
                                               double targetHeight,
                                               double visibleVal,
                                               double invisibleVal,
                                               double outOfRangeVal,
                                               double noDataVal,
                                               double dfCurvCoeff,
                                               ViewshedMode mode,
                                               double maxDistance)
      • AutoCreateWarpedVRT

        public static Dataset AutoCreateWarpedVRT​(Dataset src_ds,
                                                  java.lang.String src_wkt,
                                                  java.lang.String dst_wkt,
                                                  int eResampleAlg,
                                                  double maxerror)
      • AutoCreateWarpedVRT

        public static Dataset AutoCreateWarpedVRT​(Dataset src_ds,
                                                  java.lang.String src_wkt,
                                                  java.lang.String dst_wkt,
                                                  int eResampleAlg)
      • AutoCreateWarpedVRT

        public static Dataset AutoCreateWarpedVRT​(Dataset src_ds,
                                                  java.lang.String src_wkt,
                                                  java.lang.String dst_wkt)
      • AutoCreateWarpedVRT

        public static Dataset AutoCreateWarpedVRT​(Dataset src_ds,
                                                  java.lang.String src_wkt)
      • AutoCreateWarpedVRT

        public static Dataset AutoCreateWarpedVRT​(Dataset src_ds)
      • CreatePansharpenedVRT

        public static Dataset CreatePansharpenedVRT​(java.lang.String pszXML,
                                                    Band panchroBand,
                                                    Band[] nInputSpectralBands)
      • ApplyVerticalShiftGrid

        public static Dataset ApplyVerticalShiftGrid​(Dataset src_ds,
                                                     Dataset grid_ds,
                                                     boolean inverse,
                                                     double srcUnitToMeter,
                                                     double dstUnitToMeter,
                                                     java.util.Vector options)
      • ApplyVerticalShiftGrid

        public static Dataset ApplyVerticalShiftGrid​(Dataset src_ds,
                                                     Dataset grid_ds,
                                                     boolean inverse,
                                                     double srcUnitToMeter,
                                                     double dstUnitToMeter)
      • ApplyVerticalShiftGrid

        public static Dataset ApplyVerticalShiftGrid​(Dataset src_ds,
                                                     Dataset grid_ds,
                                                     boolean inverse,
                                                     double srcUnitToMeter)
      • ApplyVerticalShiftGrid

        public static Dataset ApplyVerticalShiftGrid​(Dataset src_ds,
                                                     Dataset grid_ds,
                                                     boolean inverse)
      • ApplyVerticalShiftGrid

        public static Dataset ApplyVerticalShiftGrid​(Dataset src_ds,
                                                     Dataset grid_ds)
      • ApplyGeoTransform

        public static void ApplyGeoTransform​(double[] padfGeoTransform,
                                             double dfPixel,
                                             double dfLine,
                                             double[] pdfGeoX,
                                             double[] pdfGeoY)
      • InvGeoTransform

        public static int InvGeoTransform​(double[] gt_in,
                                          double[] gt_out)
      • VersionInfo

        public static java.lang.String VersionInfo​(java.lang.String request)
      • VersionInfo

        public static java.lang.String VersionInfo()
      • AllRegister

        public static void AllRegister()
      • GDALDestroyDriverManager

        public static void GDALDestroyDriverManager()
      • GetCacheMax

        public static int GetCacheMax()
      • GetCacheUsed

        public static int GetCacheUsed()
      • SetCacheMax

        public static void SetCacheMax​(int nBytes)
      • GetDataTypeSize

        public static int GetDataTypeSize​(int eDataType)
      • DataTypeIsComplex

        public static int DataTypeIsComplex​(int eDataType)
      • GetDataTypeName

        public static java.lang.String GetDataTypeName​(int eDataType)
      • GetDataTypeByName

        public static int GetDataTypeByName​(java.lang.String pszDataTypeName)
      • GetColorInterpretationName

        public static java.lang.String GetColorInterpretationName​(int eColorInterp)
      • GetPaletteInterpretationName

        public static java.lang.String GetPaletteInterpretationName​(int ePaletteInterp)
      • DecToDMS

        public static java.lang.String DecToDMS​(double dfAngle,
                                                java.lang.String pszAxis,
                                                int nPrecision)
      • DecToDMS

        public static java.lang.String DecToDMS​(double dfAngle,
                                                java.lang.String pszAxis)
      • PackedDMSToDec

        public static double PackedDMSToDec​(double dfPacked)
      • DecToPackedDMS

        public static double DecToPackedDMS​(double dfDec)
      • ParseXMLString

        public static XMLNode ParseXMLString​(java.lang.String pszXMLString)
      • SerializeXMLTree

        public static java.lang.String SerializeXMLTree​(XMLNode xmlnode)
      • GetJPEG2000StructureAsString

        public static java.lang.String GetJPEG2000StructureAsString​(java.lang.String pszFilename,
                                                                    java.util.Vector options)
      • GetJPEG2000StructureAsString

        public static java.lang.String GetJPEG2000StructureAsString​(java.lang.String pszFilename)
      • GetDriverCount

        public static int GetDriverCount()
      • GetDriverByName

        public static Driver GetDriverByName​(java.lang.String name)
      • GetDriver

        public static Driver GetDriver​(int i)
      • Open

        public static Dataset Open​(java.lang.String utf8_path,
                                   int eAccess)
      • Open

        public static Dataset Open​(java.lang.String name)
      • OpenEx

        public static Dataset OpenEx​(java.lang.String utf8_path,
                                     long nOpenFlags,
                                     java.util.Vector allowed_drivers,
                                     java.util.Vector open_options,
                                     java.util.Vector sibling_files)
      • OpenEx

        public static Dataset OpenEx​(java.lang.String utf8_path,
                                     long nOpenFlags,
                                     java.util.Vector allowed_drivers,
                                     java.util.Vector open_options)
      • OpenEx

        public static Dataset OpenEx​(java.lang.String utf8_path,
                                     long nOpenFlags,
                                     java.util.Vector allowed_drivers)
      • OpenEx

        public static Dataset OpenEx​(java.lang.String utf8_path,
                                     long nOpenFlags)
      • OpenEx

        public static Dataset OpenEx​(java.lang.String utf8_path)
      • OpenShared

        public static Dataset OpenShared​(java.lang.String utf8_path,
                                         int eAccess)
      • OpenShared

        public static Dataset OpenShared​(java.lang.String utf8_path)
      • IdentifyDriver

        public static Driver IdentifyDriver​(java.lang.String utf8_path,
                                            java.util.Vector papszSiblings)
      • IdentifyDriver

        public static Driver IdentifyDriver​(java.lang.String utf8_path)
      • IdentifyDriverEx

        public static Driver IdentifyDriverEx​(java.lang.String utf8_path,
                                              long nIdentifyFlags,
                                              java.util.Vector allowed_drivers,
                                              java.util.Vector sibling_files)
      • IdentifyDriverEx

        public static Driver IdentifyDriverEx​(java.lang.String utf8_path,
                                              long nIdentifyFlags,
                                              java.util.Vector allowed_drivers)
      • IdentifyDriverEx

        public static Driver IdentifyDriverEx​(java.lang.String utf8_path,
                                              long nIdentifyFlags)
      • IdentifyDriverEx

        public static Driver IdentifyDriverEx​(java.lang.String utf8_path)
      • GeneralCmdLineProcessor

        public static java.util.Vector GeneralCmdLineProcessor​(java.util.Vector papszArgv,
                                                               int nOptions)
      • GeneralCmdLineProcessor

        public static java.util.Vector GeneralCmdLineProcessor​(java.util.Vector papszArgv)
      • GDALInfo

        public static java.lang.String GDALInfo​(Dataset hDataset,
                                                InfoOptions infoOptions)
      • DEMProcessing

        public static Dataset DEMProcessing​(java.lang.String dest,
                                            Dataset dataset,
                                            java.lang.String pszProcessing,
                                            java.lang.String pszColorFilename,
                                            DEMProcessingOptions options)
      • BuildVRT

        public static Dataset BuildVRT​(java.lang.String dest,
                                       java.util.Vector source_filenames,
                                       BuildVRTOptions options)