@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdGeoPackageModelDecoder extends Object implements ILcdModelDecoder,ILcdDataSourceModelDecoder
File | Required | Entry point | Description |
---|---|---|---|
*.gpkg | X | X | The database file |
TLcdDatabaseModel
for vector data and ILcdModel
for raster and elevation data.ILcdModelTreeNode
that contains a model for each dataset as described above.TLcdGeoPackageModelDescriptor
.
ILcdEarthModelDescriptor
interface.ILcdImageModelDescriptor
interface.ILcdDatabaseModelDescriptor
interface.
This exposes a data model with one data type.
Each non-geometry column of the GeoPackage table is available as a property on the data type.
The GeoPackage data type of the column is mapped on the corresponding Java type.com.luciad.reference.ILcdGridReference
or com.luciad.reference.ILcdGeodeticReference
.ILcdShape
objects:
FROMGeoPackage geometry | TOILcdShape |
---|---|
POINT | ILcdShapeList with a single ILcdPoint object |
LINESTRING | ILcdShapeList with a single ILcdPolyline object |
POLYGON | ILcdShapeList with a single ILcdComplexPolygon object |
CIRCULARARCSTRING | ILcdShapeList with a single ILcd2DEditableCircularArcBy3Points object |
LCDELLIPTICALARC | ILcdShapeList with a single ILcd2DEditableArc object |
LCDCIRCLE | ILcdShapeList with a single ILcd2DEditableCircle object |
LCDELLIPSE | ILcdShapeList with a single ILcd2DEditableEllipse object |
MULTIPOINT | ILcdShapeList with a single ILcdPolypoint object |
MULTILINESTRING | ILcdShapeList with a single ILcdShapeList with ILcdPolyline objects |
MULTIPOLYGON | ILcdShapeList with a single ILcdShapeList with ILcdComplexPolygon objects |
GEOMETRYCOLLECTION | ILcdShapeList with objects from this table (also recursive) |
ILcdDataObject
with the data type described above.setMaxCacheSize(int)
to learn how caching can affect performance.MULTISURFACE
and CURVEPOLYGON
, are not supported.LCDELLIPTICALARC
, LCDCIRCLE
, LCDELLIPSE
are geometry types that are added as extensions to GeoPackage.
These extensions allow you to store the corresponding shape in a GeoPackage.
GeoPackage files containing these geometry types can only be opened with Luciad software products.
ALcdImage
and ILcdEarthTileSet
.
The tiling structure of this tile set matches the tile matrix set defined by the OGC GeoPackage dataset.ALcdMultilevelImageMosaic
.
The tiling structure of this tile set matches the tile matrix set defined by the OGC GeoPackage dataset.ELcdImageSamplingMode
according to the following table.
Grid Cell Encoding | Sampling Mode |
---|---|
grid-value-is-center | AREA |
grid-value-is-area | AREA |
grid-value-is-corner | POINT |
ILcdModel.addElement(java.lang.Object, int)
, ILcdModel.removeElement(java.lang.Object, int)
, ILcdModel.elementChanged(java.lang.Object, int)
etc.) are only
applied in-memory, they are not automatically saved in the database.
TLcdDatabaseModel.commit()
to make the changes persistent.TLcdLockUtil.readLock(Object)
when accessing elements in the model.TLcdLockUtil.writeLock(Object)
when changing elements in the model.Decoding GeoPackage data and visualizing it on a Lightspeed map:
//First create the model
ILcdModelDecoder decoder =
new TLcdCompositeModelDecoder(TLcdServiceLoader.getInstance(ILcdModelDecoder.class));
ILcdModel model = decoder.decode("Data/GeoPackage/states.gpkg");
//Create a layer for the model
ILspLayer layer = createGeoPackageLayer(model);
//Add the layer to the Lightspeed view (an ILspView)
view.addLayer(layer);
Decoding GeoPackage data and visualizing it on a GXY map:
//First create the model
ILcdModelDecoder decoder =
new TLcdCompositeModelDecoder(TLcdServiceLoader.getInstance(ILcdModelDecoder.class));
ILcdModel model = decoder.decode("Data/GeoPackage/states.gpkg");
//Create a layer for the model with default styling
ILcdGXYLayer layer = createGXYGeoPackageLayer(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);
.gpkg
extension.Modifier and Type | Field and Description |
---|---|
static String |
FEATURES_TYPE_NAME
Type name constant for GeoPackage models containing feature data.
|
static String |
TILES_TYPE_NAME
Type name constant for GeoPackage models containing tiled raster (RGBA) data.
|
Constructor and Description |
---|
TLcdGeoPackageModelDecoder()
Creates a new GeoPackage model decoder.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeSource(ILcdDataSource aDataSource)
Checks whether the given data source can be decoded with this model decoder.
|
boolean |
canDecodeSource(String aSource)
Checks whether the given source can be decoded with this model decoder.
|
ILcdModel |
decode(String aSource)
Decodes all data sets in a GeoPackage file.
|
ILcdModel |
decodeSource(ILcdDataSource aDataSource)
Creates a model for the given data source.
|
List<TLcdGeoPackageDataSource> |
discoverDataSources(String aPath)
This interface method delegates its work to
getDataSources(String) . |
List<TLcdGeoPackageDataSource> |
getDataSources(String aSource)
Returns all possible data sources in the given GeoPackage file.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
int |
getMaxCacheSize()
Returns the maximum number of features (domain objects) that decoded models can store using hard references.
|
void |
setMaxCacheSize(int aMaxCacheSize)
Sets the maximum number of features (domain objects) that decoded models can store using hard references.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decodeModelMetadata, decodeModelMetadata
public static final String FEATURES_TYPE_NAME
public static final String TILES_TYPE_NAME
public TLcdGeoPackageModelDecoder()
public void setMaxCacheSize(int aMaxCacheSize)
Each individual decoded model (or sub-model when there are multiple datasets in the source) can store this many domain objects. More objects can be stored using soft references.
The default value is 300
.
Strategies: caching affects mainly spatial query
performance.
aMaxCacheSize > 0
: two queries are performed: one to determine overlapping object IDs,
one to retrieve the geometry and properties of each object that is not yet in cache.
This maximally reduces the amount of geometries and features that have to be read from file. aMaxCacheSize == 0
: all overlapping objects (geometries and properties) are read from file in one query.
This maximally reduces the number of queries that have to be made to the database,
which is useful if the round-trip time is high. local model
and copy all database model elements
over.
This results in a single large query upfront, and the database model can then be disposed. aMaxCacheSize
- the max number of objects cached with hard references.public int getMaxCacheSize()
The default value is 300
.
setMaxCacheSize for more information
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public boolean canDecodeSource(ILcdDataSource aDataSource)
This model decoder handles TLcdGeoPackageDataSource
data sources and TLcdDataSource
data sourcees.
The latter case delegates the source to the canDecodeSource(String)
method.
canDecodeSource
in interface ILcdModelDecoder
aDataSource
- the dataset to be decoded.true
if the data source is a TLcdGeoPackageDataSource
or a TLcdDataSource
, false
otherwisedecodeSource(com.luciad.model.ILcdDataSource)
public ILcdModel decodeSource(ILcdDataSource aDataSource) throws IOException
The data source must be a TLcdGeoPackageDataSource
, which represents one data set
in the GeoPackage file.
decodeSource
in interface ILcdModelDecoder
aDataSource
- the dataset to be decoded.class javadoc
IOException
- if the dataset cannot be loaded.canDecodeSource(com.luciad.model.ILcdDataSource)
public boolean canDecodeSource(String aSource)
This model decoder handles only .gpkg
files.
canDecodeSource
in interface ILcdModelDecoder
aSource
- the data source to be verified; typically a file name or a URL.true
if the source has .gpkg
extension.decode(String)
public ILcdModel decode(String aSource) throws IOException
class javadoc
TLcdModelTreeNode
that contains a model for each dataset.decode
in interface ILcdModelDecoder
aSource
- the GeoPackage file to be decoded.IOException
- if the file cannot be loaded.canDecodeSource(String)
public List<TLcdGeoPackageDataSource> getDataSources(String aSource) throws IOException
Each data source
corresponds to a single dataset in the file.
You can use decodeSource(com.luciad.model.ILcdDataSource)
to create a model for an individual data source.
aSource
- The GeoPackage fileIOException
- if the file cannot be readdecodeSource(com.luciad.model.ILcdDataSource)
public List<TLcdGeoPackageDataSource> discoverDataSources(String aPath) throws IOException
getDataSources(String)
. It is identical
in behavior an exists only to be compatible with the ILcdModelDecoder.discoverDataSources(String)
interface method.
Returns all possible data sources in the given GeoPackage file.
Each data source
corresponds to a single dataset in the file.
You can use decodeSource(com.luciad.model.ILcdDataSource)
to create a model for an individual data source.
discoverDataSources
in interface ILcdModelDecoder
aPath
- A path to the data source to be decoded; typically a file name or a URL.IOException
- if the file cannot be read