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 number of feature types or rasters,
in which case the root resource will be Aggregate
.
Format | Capability | Module | Type of resource |
---|---|---|---|
CSV | Read | org.apache.sis.storage |
FeatureSet |
ESRI ASCII Grid | Read/write | org.apache.sis.storage |
GridCoverageResource |
ESRI BIL/BIQ/BSQ | Read | org.apache.sis.storage |
GridCoverageResource |
Folder | Read/write | org.apache.sis.storage |
Aggregate , FeatureSet , GridCoverageResource |
(Big) GeoTIFF | Read | org.apache.sis.storage.geotiff |
Aggregate , GridCoverageResource |
GML (CRS only) | Read/write⁽¹⁾ | org.apache.sis.referencing |
Resource |
GPX | Read/write | org.apache.sis.storage.xml |
FeatureSet |
ISO 19115 XML | Read/write⁽¹⁾ | org.apache.sis.metadata |
Resource |
Landsat | Read | org.apache.sis.storage.earthobservation |
Aggregate , GridCoverageResource |
NetCDF | Read | org.apache.sis.storage.netcdf |
Aggregate , FeatureSet , GridCoverageResource |
SQL⁽²⁾ | Read | org.apache.sis.storage.sql |
Aggregate , FeatureSet |
WKT (CRS only) | Read/write⁽¹⁾ | org.apache.sis.referencing |
Resource |
World File | Read/write | org.apache.sis.storage |
GridCoverageResource , sometimes Aggregate |
Notes:
- GML, WKT and ISO 19115 cannot yet be written
throught the
DataStore
API. They require the use of specific API. - 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.4</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.