Use LayerInfo as parameter ctor
@@ -11,9 +11,12 @@ import com.esri.arcgisruntime.loadable.LoadStatus;
import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.view.MapView;
+import com.esri.arcgisruntime.ogc.wmts.WmtsLayerInfo;
import com.esri.arcgisruntime.ogc.wmts.WmtsService;
import com.esri.arcgisruntime.ogc.wmts.WmtsServiceInfo;
+import java.util.List;
+
public class WmtsLayerSample extends Application {
private MapView mapView;
@@ -45,9 +48,9 @@ public class WmtsLayerSample extends Application {
if (wmtsService.getLoadStatus() == LoadStatus.LOADED) {
WmtsServiceInfo wmtsServiceInfo = wmtsService.getServiceInfo();
// get the first layer's ID
- String layerID = wmtsServiceInfo.getLayerInfos().get(0).getId();
+ List<WmtsLayerInfo> layerInfos = wmtsServiceInfo.getLayerInfos();
// create the WMTS layer with the URL and ID
- WmtsLayer wmtsLayer = new WmtsLayer(serviceURL, layerID);
+ WmtsLayer wmtsLayer = new WmtsLayer(layerInfos.get(0));
map.setBasemap(new Basemap(wmtsLayer));
} else {
Alert alert = new Alert(Alert.AlertType.ERROR, "Failed to load WMTS layer");
