About GDAL
GDAL is a translator library for raster and vector geospatial data formats that is released under an MIT style Open Source License by the Open Source Geospatial Foundation. As a library, it presents a single raster abstract data model and single vector abstract data model to the calling application for all supported formats. It also comes with a variety of useful command line utilities for data translation and processing.
Decoding GDAL-supported formats
LuciadLightspeed uses the Java bindings of GDAL through the TLcdGDALModelDecoder
to decode various raster formats.
For a number of raster formats, we verified that the TLcdGDALModelDecoder
can decode them. For the list of confirmed raster formats, see Raster formats supported by the LuciadLightspeed GDAL decoder.
The TLcdGDALModelDecoder
also offers the option to decode unverified raster formats.
TLcdGDALModelDecoder decoder = new TLcdGDALModelDecoder();
// Configure the decoder to allow unverified formats.
decoder.setAllowUnverifiedFormats(true);
If you enable this option, the decoder attempts to decode any format that the GDAL library lists as a supported raster format. We haven’t verified the behavior of those formats though, so the decoder might not succeed in decoding the provided source.
Visualizing GDAL-supported raster formats in a GXY view
This snippet shows how to create an ILcdGXYLayer
for the ILcdModel
returned by the GDAL decoder, and how to add it to the ILcdGXYView
:
//First create the model
ILcdModelDecoder decoder = new TLcdGDALModelDecoder();
ILcdModel model = decoder.decode(sourceName);
//Create a layer for the model with default styling
ILcdGXYLayer layer = TLcdGXYLayer.create(model);
//Wrap the layer with an async layer wrapper to ensure
//that the view remains responsive while data is being painted
layer = ILcdGXYAsynchronousLayerWrapper.create(layer);
//Add the async layer to the GXY view (an ILcdGXYView)
view.addGXYLayer(layer);
This results in a GDAL layer with default styling. See Visualizing Raster Data for more information about visualizing and styling raster data in GXY views.
Visualizing GDAL-supported raster formats in a Lightspeed view
This snippet shows how to create an ILspLayer
for the ILcdModel
returned by the GDAL decoder, and add it to the ILspView
.
//First create the model
ILcdModelDecoder decoder = new TLcdGDALModelDecoder();
ILcdModel model = decoder.decode(sourceName);
//Create a layer for the model with default styling
ILspLayer layer = TLspRasterLayerBuilder.newBuilder()
.model(model)
.build();
//Add the layer to the Lightspeed view (an ILspView)
view.addLayer(layer);
This results in a GDAL layer with default styling. See Visualizing Raster Data for more information about visualizing and styling raster data in Lightspeed views.