When you want to connect to a WMTS server and visualize data, you need to know which data sets are available.
First, you need to create a
TLcdWMTSClient
instance:
String serverURL = "https://sampleservices.luciad.com/wmts";
TLcdWMTSClient wmtsClient = new TLcdWMTSClient(new URI(serverURL));
The client offers API to request all available layers:
List<String> availableLayers = new ArrayList<>();
for (TLcdWMTSLayer layer : wmtsClient.getLayers()) {
String id = layer.getId();
availableLayers.add(id);
}
Find below a runnable example which lists the available data sets on our sample server:
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import com.luciad.ogc.wmts.client.TLcdWMTSClient;
class FindAvailableDataTutorial {
public static void main(String[] args) throws Exception {
String serverURL = "https://sampleservices.luciad.com/wmts";
TLcdWMTSClient wmtsClient = new TLcdWMTSClient(new URI(serverURL));
List<String> availableLayers = new ArrayList<>();
for (TLcdWMTSLayer layer : wmtsClient.getLayers()) {
String id = layer.getId();
availableLayers.add(id);
}
System.out.println("Available WMTS layers on " + serverURL + ": \n");
availableLayers.stream()
.sorted()
.forEach(System.out::println);
}
}