When creating an ILcdModel
for a single WMS layer, you can skip the creation of a
TLcdWMSDataSource
by specifying the needed layer directly in the server URL:
String serverURL = "https://sampleservices.luciad.com/wms";
String wmsLayerName = "cities";
//Concat the url and layer name to a single string
String sourceName = String.format("%s?data=%s", serverURL, wmsLayerName);
//Decode the model
ILcdModelDecoder decoder = new TLcdOGCWMSProxyModelDecoder();
ILcdModel model = decoder.decode(sourceName);
is the equivalent of
String serverURL = "https://sampleservices.luciad.com/wms";
String wmsLayerName = "cities";
//Create the data source
TLcdWMSDataSource dataSource = TLcdWMSDataSource.newBuilder()
.uri(serverURL)
.addLayer(wmsLayerName)
.build();
//Decode the model
ILcdModelDecoder decoder = new TLcdOGCWMSProxyModelDecoder();
ILcdModel model = decoder.decodeSource(dataSource);