Class TLcdWMTSModelDecoder
- All Implemented Interfaces:
ILcdDataSourceModelDecoder
,ILcdModelDecoder
ILcdModel
object.
Input
- An instance of
TLcdWMTSDataSource
. - A String referring to the WMTS base URL.
- A String referring to the WMTS base URL and layer identifier, specified as a
data=layerName
key/value pair.
Supported transfer protocols
- This model decoder supports http and https protocols.
Model structure
- This model decoder creates a model per WMTS layer. If only a WMTS base URL is provided,
a
ILcdModelTreeNode
is returned that contains an {code ILcdModel} for each individual WMTS layer. - Each model representing a WMTS layer is of type
ILcd2DBoundsIndexedModel
andILcdMultiDimensionalModel
. In case the WMTS layer defines dimensions,ILcdMultiDimensionalModel
can be used to support dimensional filtering.
Model descriptor
- All models returned by this model decoder have a
TLcdWMTSModelDescriptor
. - The model descriptor of a model for an individual WMTS layer is also of type
ILcdImageModelDescriptor
, indicating that the model data can be accessed through theALcdImage
API. - The type name of the model descriptor is the display name of this decoder.
Model reference
- All models returned by this model decoder have an
ILcdGridReference
or anILcdGeodeticReference
.
Model elements
- Each model representing a WMTS layer contains a single element of type
ALcdMultilevelImageMosaic
. If the tile pyramid has a quad-tree structure, it is also of the typeILcdEarthTileSet
. - The model element is also of the type
ILcdWMTSClientProvider
, to allow retrieving theTLcdWMTSClient
instance that is used to communicate with the WMTS server.
Thread safety
- A decoder instance can be used concurrently, provided the used
ILcdTransport
is thread-safe (default). - Decoded model instances can also be used concurrently, provided the
ILcdTransport
is thread-safe.
Sample code
Decoding a WMTS data source:
String serverURL = "https://sampleservices.luciad.com/wmts";
String layerName = "4ceea49c-3e7c-4e2d-973d-c608fb2fb07e";
//Create the data source
TLcdWMTSDataSource dataSource = TLcdWMTSDataSource.newBuilder()
.uri(serverURL)
.layer(layerName)
.build();
//Decode the model
ILcdModelDecoder decoder = new TLcdWMTSModelDecoder();
ILcdModel model = decoder.decodeSource(dataSource);
Decoding a string containing the server URL and WMTS layer name
String serverURL = "https://sampleservices.luciad.com/wmts";
String layerName = "4ceea49c-3e7c-4e2d-973d-c608fb2fb07e";
//Concat the url and layer name to a single string
String sourceName = String.format("%s?data=%s", serverURL, layerName);
//Decode the model
ILcdModelDecoder decoder = new TLcdWMTSModelDecoder();
ILcdModel model = decoder.decode(sourceName);
Supported versions and specifications
- This model decoder supports WMTS servers that comply with the OGC WMTS 1.0 specification. For more information about the OGC WMTS specification, please refer to http://www.opengeospatial.org.
- Since:
- 2013.0
-
Constructor Summary
ConstructorDescriptionCreates a new WMTS model decoder witha built-in HTTP transport
.TLcdWMTSModelDecoder
(ILcdTransport aTransport) Creates a new WMTS model decoder using the given transport.TLcdWMTSModelDecoder
(ILcdOWSTransport aTransport) Creates a new WMTS model decoder using the given transport. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeSource
(ILcdDataSource aDataSource) Checks whether the given source represents WMTS data.boolean
canDecodeSource
(String aSourceName) Checks whether the given source is a WMTS server.Creates a new model for the WMTS data in the server.decodeSource
(ILcdDataSource aDataSource) Creates a new model for the WMTS data in the server represented by aTLcdWMTSDataSource
.discoverDataSources
(String aSource) Discovers all the WMTS layers a given source has to offer and returns them as a list of data sources.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.model.ILcdModelDecoder
decodeModelMetadata, decodeModelMetadata
-
Constructor Details
-
TLcdWMTSModelDecoder
public TLcdWMTSModelDecoder()Creates a new WMTS model decoder witha built-in HTTP transport
. -
TLcdWMTSModelDecoder
Creates a new WMTS model decoder using the given transport.- Parameters:
aTransport
- The transport used for connections to the server.- See Also:
-
TLcdWMTSModelDecoder
Creates a new WMTS model decoder using the given transport.- Parameters:
aTransport
- The transport used for connections to the server.- See Also:
-
-
Method Details
-
getDisplayName
Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.- Specified by:
getDisplayName
in interfaceILcdModelDecoder
- Returns:
- Always "WMTS"
-
canDecodeSource
Checks whether the given source is a WMTS server.Returns
true
if:- The source is a HTTP or HTTPS url
- The server responds to a WMTS GetCapabilities request
- Specified by:
canDecodeSource
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the data source to be verified.- Returns:
true
if the source represents a WMTS server,false
otherwise.- See Also:
-
canDecodeSource
Checks whether the given source represents WMTS data.Returns
true
if the object is aTLcdWMTSDataSource
.This call will not make a connection to the server.
- Specified by:
canDecodeSource
in interfaceILcdModelDecoder
- Parameters:
aDataSource
- the source to be verified.- Returns:
true
if the source is aTLcdWMTSDataSource
,false
otherwise.- See Also:
-
decode
Creates a new model for the WMTS data in the server.The model will be a
ILcdModelTreeNode
that contains anotherILcdModel
for each available WMTS layer on the server.The models for each layer contain:
- If the layer has a quadtree structure: An instance of both
ILcdEarthTileSet
andALcdMultilevelImageMosaic
- If the layer has a non-quadtree structure: An instance of
ALcdMultilevelImageMosaic
The
aSourceName
parameter is expected in the format ofURI?data=LayerName
.- If you only provide the server URI, it will return an ILcdModelTreeNode with a sub-model for each WMTS layer on the server.
- If you provide both URI and layer name, it will return an ILcdMultiDimensionalModel with specified layer data.
Additionally, the contained model instance is also of the type
ILcdWMTSClientProvider
, to allow retrieving theTLcdWMTSClient
instance that is used to communicate with the WMTS server.All models have a
TLcdWMTSModelDescriptor
.- Specified by:
decode
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the source to be decoded, can be a formatted asURI?data=LayerName
to identify the server URI and layer name.- Returns:
- The decoded model
- Throws:
IOException
- If the connections to the server fails, or if the server is not a WMTS server, or ifaSourceName
is not well formatted.- See Also:
- If the layer has a quadtree structure: An instance of both
-
decodeSource
Creates a new model for the WMTS data in the server represented by aTLcdWMTSDataSource
.If the data source does not specify a
layer
, the model will be aILcdModelTreeNode
that contains anotherILcdModel
for each available WMTS layer on the server.If the data source does specify a layer, a single model for this layer will be returned.
The models for each layer contain:
- If the layer has a quadtree structure: An instance of both
ILcdEarthTileSet
andALcdMultilevelImageMosaic
- If the layer has a non-quadtree structure: An instance of
ALcdMultilevelImageMosaic
Additionally, the contained model instance is also of the type
ILcdWMTSClientProvider
, to allow retrieving theTLcdWMTSClient
instance that is used to communicate to the WMTS server.All models will have a
TLcdWMTSModelDescriptor
.- Specified by:
decodeSource
in interfaceILcdModelDecoder
- Parameters:
aDataSource
- the source to be decoded, must be aTLcdWMTSDataSource
.- Returns:
- The decoded model
- Throws:
IOException
- If the connections to the server fails, or if the server is not a WMTS server.- See Also:
- If the layer has a quadtree structure: An instance of both
-
discoverDataSources
Discovers all the WMTS layers a given source has to offer and returns them as a list of data sources. If the given source is not a valid WMTS URI, this method will throw. You can check beforehand if a source is a valid WMTS URI usingcanDecodeSource(String)
.Once you have the list of data sources, you can select and decode them using
decodeSource(com.luciad.model.ILcdDataSource)
.- Specified by:
discoverDataSources
in interfaceILcdModelDecoder
- Parameters:
aSource
- the source, which must be a valid WMTS URI- Returns:
- a list of all the WMTS layers as data sources, possibly empty but never
null
- Throws:
IOException
- if the given source is not a valid WMTS URI, or if something goes wrong connecting to the URI- Since:
- 2014.0
-