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.

Format Capability Type of resource
CSV Read FeatureSet
ESRI ASCII Grid Read/write GridCoverageResource
ESRI BIL/BIQ/BSQ Read GridCoverageResource
Folder Read/write Aggregate, FeatureSet, GridCoverageResource
GeoTIFF Read Aggregate, GridCoverageResource
GML (CRS only) Read/write⁽¹⁾ Resource
GPX Read FeatureSet
ISO 19115 XML Read/write⁽¹⁾ Resource
Landsat Read Aggregate, GridCoverageResource
NetCDF Read Aggregate, FeatureSet, GridCoverageResource
SQL⁽²⁾ Read Aggregate, FeatureSet
WKT (CRS only) Read/write⁽¹⁾ Resource
World File Read/write GridCoverageResource, sometime 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).

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);
}

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:

<dependencies>
  <dependency>
    <groupId>org.apache.sis.cloud</groupId>
    <artifactId>sis-cloud-aws</artifactId>
    <version>1.2</version>
    <scope>runtime</scope>
  </dependency>
</dependencies>

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).

[default]
aws_access_key_id = <some value>
aws_secret_access_key = <some value>

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.