public final class GdalModelDecoder extends Object
Model
that are decoded using the GDAL library.
The created model is either an IRasterModel
or an IFeatureModel
giving the ability to access the data within files of the following supported formats:
Modifier and Type | Method and Description |
---|---|
static Model |
decode(String source)
Creates a model for a raster or vector file supported by the GDAL library.
|
@NotNull public static Model decode(@NotNull String source) throws IOException
See class documentation for more information on the supported file formats.
This model decoder considers single band data, using either 32-bit float or 16-bit signed integer, as raster elevation data.
Raster elevation data using single unsigned 16-bit integers are supported under the following conditions:
For more information, please read the related article: Elevation support.
try {
Model model = GdalModelDecoder.decode(source);
if (model instanceof IRasterModel) {
IRasterModel rasterModel = (IRasterModel) model;
// ...
}
} catch (IOException exception) {
Log.w("", "Failed to open file '" + source + "': " + exception.getMessage());
}
Geometry Type | Description for geometry in model |
---|---|
Point | Point |
Polyline | Polyline |
Polygon | Polygon |
MultiPoint | MultiGeometry with Point sub-geometries |
MultiPolyline | MultiGeometry with Polyline sub-geometries |
MultiPolygon | MultiGeometry with Polygon sub-geometries |
Point Z | Point |
Polyline Z | Polyline |
Polygon Z | Polygon |
MultiPoint Z | MultiGeometry with Point sub-geometries |
MultiPolyline Z | MultiGeometry with Polyline sub-geometries |
MultiPolygon Z | MultiGeometry with Polygon sub-geometries |
SHP geometry types having measurement values are not supported!
.prj
file containing the WKT representation of the Coordinate Reference System
. If it does not exist this decoder attempts to read the Coordinate Reference System
from a .epsg
file containing an EPSG code, e.g. EPSG:4326
.
FeatureQuery
expression filter can be used to filter the features that have to be loaded in memory. It supports filtering by ID, using a bounding box, and using a condition.
Note that when the condition contains expressions using a spatial bbox operator the filtering cannot be propagated efficiently to GDAL. In this case a best effort is done to translate the condition towards GDAL and a post filtering step in memory is performed.
.qix
format). When no spatial index files are available the decoder creates a spatial index file using the .qix
format.
When the index file (*.shx) or one of the spatial index files (*.sbx,*.sbn or *.qix) is missing, the decoder creates them at runtime. The index files are stored next to the source data. If the record index file *.shx
cannot be written next to the source data (e.g. no write permission) the decoding fails. If the spatial index file *.qix
cannot be written next to the source data (e.g. no write permission) the decoding continues but spatial filtering will be slower.
try {
Model model = GdalModelDecoder.decode(source);
if (model instanceof IFeatureModel) {
IFeatureModel featureModel = (IFeatureModel) model;
// ...
}
} catch (IOException exception) {
Log.w("", "Failed to open file '" + source + "': " + exception.getMessage());
}
source
- The absolute path to the file.IOException
- when decoding the source file fails.