When you want to connect to a WCS server and visualize data, you need to know which data sets are available.

First, you need to create a TLcdWCSClient instance:

String serverURL = "https://sampleservices.luciad.com/wcs";
TLcdWCSClient wcsClient = TLcdWCSClient.createWCSClient(new URI(serverURL));

The client offers API to perform a GetCapabilities request:

TLcdWCSCapabilities capabilities = wcsClient.getCachedCapabilities();

The return value is a Java object representing the capabilities exposed by the server.

We can now retrieve the content metadata from the capabilities, and from that content metadata loop over the available WCS coverages:

List<String> availableCoverages = new ArrayList<>();
TLcdWCSContentMetadata contentMetadata = capabilities.getContentMetadata();
for (int i = 0; i < contentMetadata.getCoverageOfferingBriefCount(); i++) {
  TLcdWCSCoverageOfferingBrief coverageOfferingBrief = contentMetadata.getCoverageOfferingBrief(i);
  availableCoverages.add(coverageOfferingBrief.getName());
}

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.wcs.client.TLcdWCSClient;
import com.luciad.ogc.wcs.common.model.TLcdWCSCapabilities;
import com.luciad.ogc.wcs.common.model.TLcdWCSContentMetadata;
import com.luciad.ogc.wcs.common.model.TLcdWCSCoverageOfferingBrief;

class FindAvailableDataTutorial {

  public static void main(String[] args) throws Exception {
    String serverURL = "https://sampleservices.luciad.com/wcs";
    TLcdWCSClient wcsClient = TLcdWCSClient.createWCSClient(new URI(serverURL));

    TLcdWCSCapabilities capabilities = wcsClient.getCachedCapabilities();

    List<String> availableCoverages = new ArrayList<>();
    TLcdWCSContentMetadata contentMetadata = capabilities.getContentMetadata();
    for (int i = 0; i < contentMetadata.getCoverageOfferingBriefCount(); i++) {
      TLcdWCSCoverageOfferingBrief coverageOfferingBrief = contentMetadata.getCoverageOfferingBrief(i);
      availableCoverages.add(coverageOfferingBrief.getName());
    }

    System.out.println("Available WCS coverages on " + serverURL + ": \n");
    availableCoverages.stream()
                      .sorted()
                      .forEach(System.out::println);
  }
}