GDAL is a translator library for raster and vector geospatial data formats
GDAL supports reading and writing in a plethora of
raster and
vector formats. And, while GeoTrellis
supports a few of the most popular, there's currently no plan to achieve
format parity with GDAL. If you'd like to work with an esoteric format
(which GDAL supports), you're in luck: geotrellis.gdal
leans on
GDAL to effectively extend the range of formats with which GeoTrellis can work.
NOTE: Using the geotrellis.gdal
module requires a working installation of
GDAL's java bindings.
In the following example, we will look at the code necessary to attempt
a read of an HDF5 raster band. The
result of a successful reading is an tuple of the form
(geotrellis.raster.Tile, geotrellis.raster.RasterExtent)
.
import geotrellis.gdal._
val firstBand: (Tile, RasterExtent) =
GdalReader.read(path = "/path/to/my/file.he5", band = 1)
Note that the band
parameter specifies the band to be read and turned
into a tile rather than the number of bands expected.