If you know the URL of the server and the feature type name to which you want to connect, you can use the model decoder to create a WFS model:
static ILcdModel createWFSModelFromString(ILcyLucyEnv aLucyEnv) throws IOException {
String serverName = "https://sampleservices.luciad.com/wfs";
String featureTypeName = "rivers";
//The source name passed to the model decoder should include the server
//and the feature type name name
String sourceName = serverName + "?data=" + featureTypeName;
//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 createWFSModelFromDataSource(ILcyLucyEnv aLucyEnv) throws IOException {
String serverName = "https://sampleservices.luciad.com/wfs";
String featureTypeName = "rivers";
//Create a data source
TLcdWFSDataSource dataSource = TLcdWFSDataSource.newBuilder()
.uri(serverName)
.featureTypeName(featureTypeName)
.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;
}