Package org.gdal.gdal

## Class Driver

- java.lang.Object
- - org.gdal.gdal.MajorObject
  - - org.gdal.gdal.Driver

-     public class Driver
      extends MajorObject

  Class Driver is an uninstanciable class providing various methods for a format specific driver.

  The Driver class is a binding for the C++ GDALDriver class.

  An instance of this class is created for each supported format, and manages information about the format. This roughly corresponds to a file format, though some drivers may be gateways to many formats through a secondary multi-library.

  Drivers are loaded and registered with the gdal.AllRegister() method

- - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `CopyFiles​(java.lang.String newName, java.lang.String oldName)` |
    `Dataset` | `Create​(java.lang.String name, int xsize, int ysize)` | Create a new dataset with this driver.
    `Dataset` | `Create​(java.lang.String name, int xsize, int ysize, int nBands)` | Create a new dataset with this driver.
    `Dataset` | `Create​(java.lang.String name, int xsize, int ysize, int nBands, int eType)` | Create a new dataset with this driver.
    `Dataset` | `Create​(java.lang.String name, int xsize, int ysize, int nBands, int eType, java.lang.String[] options)` | Create a new dataset with this driver.
    `Dataset` | `Create​(java.lang.String name, int xsize, int ysize, int nBands, int eType, java.util.Vector options)` | Create a new dataset with this driver.
    `Dataset` | `Create​(java.lang.String name, int xsize, int ysize, int nBands, java.lang.String[] options)` | Create a new dataset with this driver.
    `Dataset` | `CreateCopy​(java.lang.String name, Dataset src_ds)` | Create a copy of a dataset.
    `Dataset` | `CreateCopy​(java.lang.String name, Dataset src_ds, int strict)` | Create a copy of a dataset.
    `Dataset` | `CreateCopy​(java.lang.String name, Dataset src_ds, int strict, java.lang.String[] options)` | Create a copy of a dataset.
    `Dataset` | `CreateCopy​(java.lang.String name, Dataset src_ds, int strict, java.util.Vector options)` | Create a copy of a dataset.
    `Dataset` | `CreateCopy​(java.lang.String name, Dataset src_ds, int strict, java.util.Vector options, ProgressCallback callback)` | Create a copy of a dataset.
    `Dataset` | `CreateCopy​(java.lang.String name, Dataset src_ds, java.lang.String[] options)` | Create a copy of a dataset.
    `Dataset` | `CreateCopy​(java.lang.String name, Dataset src_ds, java.util.Vector options)` | Create a copy of a dataset.
    `Dataset` | `CreateMultiDimensional​(java.lang.String utf8_path)` |
    `Dataset` | `CreateMultiDimensional​(java.lang.String utf8_path, java.util.Vector root_group_options)` |
    `Dataset` | `CreateMultiDimensional​(java.lang.String utf8_path, java.util.Vector root_group_options, java.util.Vector options)` |
    `void` | `delete()` | Deprecated. Do not do anything...
    `int` | `Delete​(java.lang.String name)` | Delete named dataset.
    `void` | `Deregister()` | Deregister the driver.
    `java.lang.String` | `getHelpTopic()` | Return the URL to the help that describes the driver.
    `java.lang.String` | `getLongName()` | Return the long name of a driver.
    `java.lang.String` | `getShortName()` | Return the short name of a driver.
    `int` | `Register()` | Register a driver for use.
    `int` | `Rename​(java.lang.String newName, java.lang.String oldName)` | Rename a dataset.

    - ### Methods inherited from class org.gdal.gdal.MajorObject

      `GetDescription, GetMetadata_Dict, GetMetadata_Dict, GetMetadata_List, GetMetadata_List, GetMetadataDomainList, GetMetadataItem, GetMetadataItem, SetDescription, SetMetadata, SetMetadata, SetMetadata, SetMetadata, SetMetadata, SetMetadata, SetMetadataItem, SetMetadataItem`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### delete

          public void delete()

      Deprecated.
      Do not do anything...
      Overrides:
        `delete` in class `MajorObject`

    - #### Create

          public Dataset Create​(java.lang.String name,
                                int xsize,
                                int ysize,
                                int nBands,
                                int eType,
                                java.lang.String[] options)

      Create a new dataset with this driver.

      What argument values are legal for particular drivers is driver specific, and there is no way to query in advance to establish legal values (except querying driver.GetMetadataItem(gdalconst.DMD_CREATIONOPTIONLIST)

      That function will try to validate the creation option list passed to the driver with the GDALValidateCreationOptions() method. This check can be disabled by defining the configuration option GDAL_VALIDATE_CREATION_OPTIONS=NO.

      At the end of dataset manipulation, the delete() method must be called on the returned dataset otherwise data might not be properly flushed to the disk.

      Parameters:
        `name` - the name of the dataset to create.
        `xsize` - width of created raster in pixels.
        `ysize` - height of created raster in pixels.
        `nBands` - number of bands.
        `eType` - type of raster.
        `options` - list of driver specific control parameters (may be null)
      Returns:
        null on failure, or a Dataset object
      Since:
        Java bindings 1.7.0

    - #### Create

          public Dataset Create​(java.lang.String name,
                                int xsize,
                                int ysize,
                                int nBands,
                                java.lang.String[] options)

      Create a new dataset with this driver.

      Same as below with eType == gdalconst.GDT_Byte

      Since:
        Java bindings 1.7.0
      See Also:
        `Create(String name, int xsize, int ysize, int nBands, int eType, String[] options)`

    - #### CreateCopy

          public Dataset CreateCopy​(java.lang.String name,
                                    Dataset src_ds,
                                    int strict,
                                    java.lang.String[] options)

      Create a copy of a dataset.

      Same as below with callback == null and options as an array of strings

      See Also:
        `CreateCopy(String name, Dataset src_ds, int strict, java.util.Vector options, ProgressCallback callback)`

    - #### CreateCopy

          public Dataset CreateCopy​(java.lang.String name,
                                    Dataset src_ds,
                                    java.util.Vector options)

      Create a copy of a dataset.

      Same as below with strict == 1 and callback == null

      Since:
        Java bindings 1.7.0
      See Also:
        `CreateCopy(String name, Dataset src_ds, int strict, java.util.Vector options, ProgressCallback callback)`

    - #### CreateCopy

          public Dataset CreateCopy​(java.lang.String name,
                                    Dataset src_ds,
                                    java.lang.String[] options)

      Create a copy of a dataset.

      Same as below with strict == 1, callback == null and options as an array of strings

      Since:
        Java bindings 1.7.0
      See Also:
        `CreateCopy(String name, Dataset src_ds, int strict, java.util.Vector options, ProgressCallback callback)`

    - #### getShortName

          public java.lang.String getShortName()

      Return the short name of a driver.

      This is the string that can be passed to the GDALGetDriverByName() function.

      For the GeoTIFF driver, this is "GTiff"

      Returns:
        the short name of the driver.

    - #### getLongName

          public java.lang.String getLongName()

      Return the long name of a driver.

      For the GeoTIFF driver, this is "GeoTIFF"

      Returns:
        the long name of the driver or empty string.

    - #### getHelpTopic

          public java.lang.String getHelpTopic()

      Return the URL to the help that describes the driver.

      That URL is relative to the GDAL documentation directory.

      For the GeoTIFF driver, this is "frmt_gtiff.html"

      Returns:
        the URL to the help that describes the driver or null

    - #### Create

          public Dataset Create​(java.lang.String name,
                                int xsize,
                                int ysize,
                                int nBands,
                                int eType,
                                java.util.Vector options)

      Create a new dataset with this driver.

      Same as below but options are passed as a Vector of String.

      See Also:
        `Create(String name, int xsize, int ysize, int nBands, int eType, String[] options)`

    - #### Create

          public Dataset Create​(java.lang.String name,
                                int xsize,
                                int ysize,
                                int nBands,
                                int eType)

      Create a new dataset with this driver.

      Same as below with options == null

      Since:
        Java bindings 1.7.0
      See Also:
        `Create(String name, int xsize, int ysize, int nBands, int eType, String[] options)`

    - #### Create

          public Dataset Create​(java.lang.String name,
                                int xsize,
                                int ysize,
                                int nBands)

      Create a new dataset with this driver.

      Same as below with eType == gdalconst.GDT_Byte and options == null

      Since:
        Java bindings 1.7.0
      See Also:
        `Create(String name, int xsize, int ysize, int nBands, int eType, String[] options)`

    - #### Create

          public Dataset Create​(java.lang.String name,
                                int xsize,
                                int ysize)

      Create a new dataset with this driver.

      Same as below with nbands == 1, eType == gdalconst.GDT_Byte and options == null

      Since:
        Java bindings 1.7.0
      See Also:
        `Create(String name, int xsize, int ysize, int nBands, int eType, String[] options)`

    - #### CreateMultiDimensional

          public Dataset CreateMultiDimensional​(java.lang.String utf8_path,
                                                java.util.Vector root_group_options,
                                                java.util.Vector options)

    - #### CreateMultiDimensional

          public Dataset CreateMultiDimensional​(java.lang.String utf8_path,
                                                java.util.Vector root_group_options)

    - #### CreateMultiDimensional

          public Dataset CreateMultiDimensional​(java.lang.String utf8_path)

    - #### CreateCopy

          public Dataset CreateCopy​(java.lang.String name,
                                    Dataset src_ds,
                                    int strict,
                                    java.util.Vector options,
                                    ProgressCallback callback)

      Create a copy of a dataset.

      This method will attempt to create a copy of a raster dataset with the indicated filename, and in this drivers format. Band number, size, type, projection, geotransform and so forth are all to be copied from the provided template dataset.

      Note that many sequential write once formats (such as JPEG and PNG) don't implement the Create() method but do implement this CreateCopy() method. If the driver doesn't implement CreateCopy(), but does implement Create() then the default CreateCopy() mechanism built on calling Create() will be used.

      It is intended that CreateCopy() will often be used with a source dataset which is a virtual dataset allowing configuration of band types, and other information without actually duplicating raster data (see the VRT driver). This is what is done by the gdal_translate utility for example.

      That function will try to validate the creation option list passed to the driver with the GDALValidateCreationOptions() method. This check can be disabled by defining the configuration option GDAL_VALIDATE_CREATION_OPTIONS=NO.

      At the end of dataset manipulation, the delete() method must be called on the returned dataset otherwise data might not be properly flushed to the disk.

      Parameters:
        `name` - the name for the new dataset.
        `src_ds` - the dataset being duplicated.
        `strict` - 1 if the copy must be strictly equivalent, or more normally 0 indicating that the copy may adapt as needed for the output format.
        `options` - additional format dependent options controlling creation of the output file.
        `callback` - for reporting algorithm progress. May be null
      Returns:
        the newly created dataset (may be read-only access).
      Since:
        Java bindings 1.7.0

    - #### CreateCopy

          public Dataset CreateCopy​(java.lang.String name,
                                    Dataset src_ds,
                                    int strict,
                                    java.util.Vector options)

      Create a copy of a dataset.

      Same as below with callback == null

      See Also:
        `CreateCopy(String name, Dataset src_ds, int strict, java.util.Vector options, ProgressCallback callback)`

    - #### CreateCopy

          public Dataset CreateCopy​(java.lang.String name,
                                    Dataset src_ds,
                                    int strict)

      Create a copy of a dataset.

      Same as below with options == null and callback == null

      Since:
        Java bindings 1.7.0
      See Also:
        `CreateCopy(String name, Dataset src_ds, int strict, java.util.Vector options, ProgressCallback callback)`

    - #### CreateCopy

          public Dataset CreateCopy​(java.lang.String name,
                                    Dataset src_ds)

      Create a copy of a dataset.

      Same as below with strict == 1, options == null and callback == null

      Since:
        Java bindings 1.7.0
      See Also:
        `CreateCopy(String name, Dataset src_ds, int strict, java.util.Vector options, ProgressCallback callback)`

    - #### Delete

          public int Delete​(java.lang.String name)

      Delete named dataset.

      The driver will attempt to delete the named dataset in a driver specific fashion. Full featured drivers will delete all associated files, database objects, or whatever is appropriate. The default behavior when no driver specific behavior is provided is to attempt to delete the passed name as a single file.

      It is unwise to have open dataset handles on this dataset when it is deleted.

      Parameters:
        `name` - name of dataset to delete.
      Returns:
        gdalconst.CE_None on success, or gdalconst.CE_Failure if the operation fails.

    - #### Rename

          public int Rename​(java.lang.String newName,
                            java.lang.String oldName)

      Rename a dataset.

      Rename a dataset. This may including moving the dataset to a new directory or even a new filesystem.

      It is unwise to have open dataset handles on this dataset when it is being renamed.

      Parameters:
        `newName` - new name for the dataset.
        `oldName` - old name for the dataset.
      Returns:
        gdalconst.CE_None on success, or gdalconst.CE_Failure if the operation fails.

    - #### CopyFiles

          public int CopyFiles​(java.lang.String newName,
                               java.lang.String oldName)

    - #### Register

          public int Register()

      Register a driver for use.

      Normally this method is used by format specific C callable registration entry points such as GDALRegister_GTiff() rather than being called directly by application level code.

      If this driver is already registered, then no change is made, and the index of the existing driver is returned. Otherwise the driver list is extended, and the new driver is added at the end.

      Returns:
        the index of the new installed driver.

    - #### Deregister

          public void Deregister()

      Deregister the driver.