Package org.gdal.gdal

Class 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 Details

    • delete

      public void delete()
      Deprecated.
      Do not do anything...
      Overrides:
      delete in class MajorObject
    • Create

      public Dataset Create(String name, int xsize, int ysize, int nBands, int eType, 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(String name, int xsize, int ysize, int nBands, 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:
    • CreateCopy

      public Dataset CreateCopy(String name, Dataset src_ds, int strict, String[] options)
      Create a copy of a dataset.

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

      See Also:
    • CreateCopy

      public Dataset CreateCopy(String name, Dataset src_ds, 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

      public Dataset CreateCopy(String name, Dataset src_ds, 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:
    • getShortName

      public 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 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 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(String name, int xsize, int ysize, int nBands, int eType, Vector options)
      Create a new dataset with this driver.

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

      See Also:
    • Create

      public Dataset Create(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

      public Dataset Create(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

      public Dataset Create(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:
    • CreateMultiDimensional

      public Dataset CreateMultiDimensional(String utf8_path, Vector root_group_options, Vector options)
    • CreateMultiDimensional

      public Dataset CreateMultiDimensional(String utf8_path, Vector root_group_options)
    • CreateMultiDimensional

      public Dataset CreateMultiDimensional(String utf8_path)
    • CreateCopy

      public Dataset CreateCopy(String name, Dataset src_ds, int strict, 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(String name, Dataset src_ds, int strict, Vector options)
      Create a copy of a dataset.

      Same as below with callback == null

      See Also:
    • CreateCopy

      public Dataset CreateCopy(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

      public Dataset CreateCopy(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:
    • Delete

      public int Delete(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(String newName, 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(String newName, 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.