Class GDALStoreProvider

Object
DataStoreProvider
GDALStoreProvider

public class GDALStoreProvider extends DataStoreProvider
The provider of GDALStore instances. Given a Storage­Connector input, this class tries to instantiate a GDALStore. This data store uses the GDAL native library for loading data.

Each GDALStore­Provider instance is linked to a GDAL library specified at construction time, or to a JVM-wide shared GDAL library if the no-argument constructor is used. In the non-shared case, GDAL will be unloaded when this GDALStore­Provider instance is garbage collected.

Since:
1.5
  • Field Details

    • DRIVERS_OPTION_KEY

      public static final OptionKey<String[]> DRIVERS_OPTION_KEY
      Key for declaring GDAL drivers that may be used for opening the file. Drivers are identified by their short names. The drivers will be tested in the order they are specified.
      See Also:
  • Constructor Details

    • GDALStoreProvider

      public GDALStoreProvider() throws DataStoreException
      Creates a new provider which will load the GDAL library from the default library path.

      This constructor is public for compatibility with usage of SIS on the class-path. It may become protected in a future version of Apache SIS, if the use of module-path become mandatory.

      Throws:
      Data­Store­Exception - if the GDAL library has not been found or if this Apache SIS module is not authorized to call native methods.
      See Also:
  • Method Details

    • provider

      public static GDALStoreProvider provider() throws DataStoreException
      Returns a provider which will load the GDAL library from the default library path. If the GDAL library is not found on the library path, then this method searches in the libraries loaded with System​.load­Library(String)RESTRICTED.
      Returns:
      the default data store provider using the GDAL library.
      Throws:
      Data­Store­Exception - if the GDAL library has not been found or if this Apache SIS module is not authorized to call native methods.
      Since:
      1.7
    • provider

      public static GDALStoreProvider provider(Path library) throws DataStoreException
      Creates a new provider which will load the GDAL library from the specified file. This method may return an existing provider previously created for the same path. When the returned provider will be garbage collected, the following cleanup actions will be performed:
      • The GDALDestroy native function will be invoked if this GDALStore­Provider instance was the last one using the specified library.
      • Then the library will be unloaded. Note that the OS may keep the library in memory if it is still used by another GDALStore­Provider instance.
      Parameters:
      library - path to the library to load.
      Returns:
      data store provider using the GDAL library at the given type.
      Throws:
      Data­Store­Exception - if the GDAL library has not been found or if this Apache SIS module is not authorized to call native methods.
      Since:
      1.7
    • getShortName

      public String getShortName()
      Returns a generic name for this data store, used mostly in warnings or error messages.
      Specified by:
      get­Short­Name in class Data­Store­Provider
      Returns:
      a short name or abbreviation for the data store.
      See Also:
    • getVersion

      public Optional<Version> getVersion()
      Returns the version number of the GDAL library. The returned version contains 4 components. Example: 3.6.3.0.
      Returns:
      GDAL version, or empty if the GDAL library has not been found.
    • getReleaseDate

      public Optional<LocalDate> getReleaseDate()
      Returns the release date of the GDAL library.
      Returns:
      the release date, or empty if the GDAL library has not been found.
    • getDrivers

      public List<Driver> getDrivers()
      Returns an unmodifiable list of all GDAL drivers currently available.
      Returns:
      all GDAL drivers, or an empty list if the GDAL library has not been found.
    • configuration

      public TreeTable configuration() throws DataStoreException
      Returns the GDAL version number together with the list of drivers. The GDAL version is in the root node, and drivers are listed as children. The table contains the following columns:
      1. invalid reference
        Table­Column#NAME
        for the value returned by
        invalid reference
        #get­Name()
        .
      2. invalid reference
        Table­Column#IDENTIFIER
        for the value returned by
        invalid reference
        #get­Identifier()
        .
      The current version lists only the drivers having raster capability, because this is the only type of data supported by the current implementation of this module.
      Returns:
      a table of available GDAL drivers.
      Throws:
      Data­Store­Exception - if an error occurred while querying GDAL metadata.
    • getOpenParameters

      public ParameterDescriptorGroup getOpenParameters()
      Returns a description of all parameters accepted by this provider for opening a file with GDAL.
      Specified by:
      get­Open­Parameters in class Data­Store­Provider
      Returns:
      description of available parameters for opening a file with GDAL.
      See Also:
    • probeContent

      public ProbeResult probeContent(StorageConnector connector) throws DataStoreException
      Returns the MIME type if the given storage appears to be supported by this data store. A supported status does not guarantee that reading or writing will succeed, only that there appears to be a reasonable chance according GDAL.
      Specified by:
      probe­Content in class Data­Store­Provider
      Parameters:
      connector - information about the storage (URL, stream, etc).
      Returns:
      a supported status with the MIME type if the given storage seems to be readable by GDALStore instances.
      Throws:
      Data­Store­Exception - if an I/O error occurred.
    • open

      public DataStore open(StorageConnector connector) throws DataStoreException
      Creates a GDALStore instance associated with this provider.
      Specified by:
      open in class Data­Store­Provider
      Parameters:
      connector - information about the storage (URL, stream, etc).
      Returns:
      a data store implementation associated with this provider for the given storage.
      Throws:
      Data­Store­Exception - if an error occurred while creating the data store instance.
      See Also:
    • open

      public DataStore open(ParameterValueGroup parameters) throws DataStoreException
      Creates a GDALStore instance from the given parameters.
      Overrides:
      open in class Data­Store­Provider
      Parameters:
      parameters - opening parameters as defined by get­Open­Parameters().
      Returns:
      a data store instance associated with this provider for the given parameters.
      Throws:
      Data­Store­Exception - if an error occurred while creating the data store instance.
      See Also:
    • getLogger

      public Logger getLogger()
      Returns the logger used by GDAL stores.
      Overrides:
      get­Logger in class Data­Store­Provider
      Returns:
      the logger to use as a fallback (when there are no listeners) for warning messages.
      See Also: