If you know the URL of the server and the name of the layer to which you want to connect, you can use the model decoder to create a WMTS model:
static ILcdModel createWMTSModelFromString(ILcyLucyEnv aLucyEnv) throws IOException {
String serverName = "https://sampleservices.luciad.com/wmts";
String layerName = "92c09725-a9c5-46fb-bffd-d9e23b4abbf2";
//The source name passed to the model decoder should include the server
//and the layer name
String sourceName = serverName + "?layer=" + layerName;
//Create a composite model decoder based on the decoders registered on the back-end
TLcyCompositeModelDecoder modelDecoder = new TLcyCompositeModelDecoder(aLucyEnv);
if (modelDecoder.canDecodeSource(sourceName)) {
return modelDecoder.decode(sourceName);
}
return null;
}
or use an ILcdDataSource
:
static ILcdModel createWMTSModelFromDataSource(ILcyLucyEnv aLucyEnv) throws IOException {
String serverName = "https://sampleservices.luciad.com/wmts";
String layerName = "92c09725-a9c5-46fb-bffd-d9e23b4abbf2";
//Create the data source
TLcdWMTSDataSource dataSource = TLcdWMTSDataSource.newBuilder()
.uri(serverName)
.layer(layerName)
.build();
//Create a composite model decoder based on the decoders registered on the back-end
TLcyCompositeModelDecoder modelDecoder = new TLcyCompositeModelDecoder(aLucyEnv);
if (modelDecoder.canDecodeSource(dataSource)) {
return modelDecoder.decodeSource(dataSource);
}
return null;
}