title: Data formats supported by Apache SIS

Apache {{% SIS %}} can read data from the formats listed below. Some formats are supported in read-only mode, others in read/write modes. Data may be structured as vectors or rasters, which in Apache {{% SIS %}} are mapped to the FeatureSet and GridCoverageResource interfaces respectively. Some formats can contain an arbitrary amount of feature types or rasters, in which case the root resource will be Aggregate.

Notes:

  1. {{% GML %}}, {{% WKT %}} and {{% ISO %}} 19115 can not yet be written throught the DataStore API. They require the use of specific API.
  2. {{% SQL %}} is not a file format but rather a connection to a database throught {{% JDBC %}} driver.

How to read

The easiest way to open a file in read-only mode is as below. The input argument can be a File, Path, URI, URL, InputStream, ReadableByteChannel or a {{% JDBC %}} DataSource (non-exhaustive list).

{{< highlight java >}} try (DataStore store = DataStores.open(input)) { // Assuming that we know that the data is a single raster: GridCoverageResource r = (GridCoverageResource) store;

// Subset of data could be specified here (no subset in this example):
GridCoverage coverage = r.read(null, null);

// Assuming that we know that the data is two-dimensional:
RenderedImage image = coverage.render(null);

} {{< / highlight >}}

Most of Apache {{% SIS %}} API is designed for multi-dimensional data. When requesting a RenderedImage, a two-dimensional slice must be specified, unless the data are already two-dimensional. The two-dimensional slice can be along any dimensions. See the SIS developer guide for more information.

Accessing data on the cloud

Data files can be located on Amazon S3 storage service. For accessing those data, add the following dependency to the Maven project:

{{< highlight xml >}} org.apache.sis.cloud sis-cloud-aws {{% version %}} runtime {{< / highlight >}}

With above dependency on the classpath, it is possible to instantiate java.nio.Path object with a value of the form "S3://bucket/pseudo-directory/file". Login and password can be specified in a ~/.aws/credentials file like below (Apache SIS does not yet manage credentials by itself).

{{< highlight config >}} [default] aws_access_key_id = aws_secret_access_key = {{< / highlight >}}

An alternative to above configuration is to set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables. See AWS developer guide for more information.