If you know the URL of the server and the name of the coverage to which you want to connect, you can use the model decoder to create a WCS model:
static ILcdModel createWCSModelFromString(ILcyLucyEnv aLucyEnv) throws IOException {
String serverName = "https://sampleservices.luciad.com/wcs";
String coverageName = "92c09725-a9c5-46fb-bffd-d9e23b4abbf2";
//The source name passed to the model decoder should include the server
//and the coverage name
String sourceName = serverName + "?data=" + coverageName;
//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 using an ILcdDataSource
:
static ILcdModel createWCSModelFromDataSource(ILcyLucyEnv aLucyEnv) throws IOException {
String serverName = "https://sampleservices.luciad.com/wcs";
String coverageName = "92c09725-a9c5-46fb-bffd-d9e23b4abbf2";
//Create a data source
TLcdWCSDataSource dataSource = TLcdWCSDataSource.newBuilder()
.uri(serverName)
.coverageName(coverageName)
.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;
}