Skip to content

Commit f33c85f

Browse files
committed
Merge branch 'main' into 200.0.0
2 parents fbd8702 + c4f1b08 commit f33c85f

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

ogc/wmts-layer/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pan and zoom to explore the WMTS layer, which is displayed automatically.
1616

1717
1. Create a `WmtsService` using the URL of the WMTS Service.
1818
2. After loading the WMTS service, get the list of `WmtsLayerInfos` from the service info: `service.getServiceInfo().getLayerInfos()`
19-
3. Use one of the layer infos to create a new `WmtsLayer(layerInfos.get(0))`
19+
3. Create a new `WmtsLayer` from a `WmtsLayerInfo`
2020
4. Set it as the map's basemap with `map.setBasemap(new Basemap(wmtsLayer))`.
2121

2222
## Relevant API
@@ -28,7 +28,7 @@ Pan and zoom to explore the WMTS layer, which is displayed automatically.
2828

2929
## About the data
3030

31-
The map visualizes world time zones.
31+
We acknowledge the use of imagery provided by services from the [Global Imagery Browse Services (GIBS)](https://wiki.earthdata.nasa.gov/display/GIBS/), operated by the [NASA/GSFC/Earth Science Data and Information System (ESDIS)](https://earthdata.nasa.gov/) with funding provided by NASA/HQ. This sample shows the Digital Elevation Model (Color Index, SRTM) layer from the WMTS service provided by GIBS, using the "SRTM_Color_Index" identifier.
3232

3333
## Tags
3434

ogc/wmts-layer/WmtsLayer.png

59 KB
Loading

ogc/wmts-layer/src/main/java/com/esri/samples/wmts_layer/WmtsLayerSample.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717
package com.esri.samples.wmts_layer;
1818

1919
import java.util.List;
20-
import javafx.application.Application;
21-
import javafx.scene.Scene;
22-
import javafx.scene.control.Alert;
23-
import javafx.scene.layout.StackPane;
24-
import javafx.stage.Stage;
20+
import java.util.stream.Collectors;
2521

2622
import com.esri.arcgisruntime.layers.WmtsLayer;
2723
import com.esri.arcgisruntime.loadable.LoadStatus;
@@ -31,6 +27,11 @@
3127
import com.esri.arcgisruntime.ogc.wmts.WmtsLayerInfo;
3228
import com.esri.arcgisruntime.ogc.wmts.WmtsService;
3329
import com.esri.arcgisruntime.ogc.wmts.WmtsServiceInfo;
30+
import javafx.application.Application;
31+
import javafx.scene.Scene;
32+
import javafx.scene.control.Alert;
33+
import javafx.scene.layout.StackPane;
34+
import javafx.stage.Stage;
3435

3536
public class WmtsLayerSample extends Application {
3637

@@ -58,15 +59,17 @@ public void start(Stage stage) {
5859
mapView.setMap(map);
5960

6061
// create a WMTS service from a URL
61-
String serviceURL = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS";
62+
String serviceURL = "https://gibs.earthdata.nasa.gov/wmts/epsg4326/best";
6263
wmtsService = new WmtsService(serviceURL);
6364
wmtsService.addDoneLoadingListener(() -> {
6465
if (wmtsService.getLoadStatus() == LoadStatus.LOADED) {
6566
WmtsServiceInfo wmtsServiceInfo = wmtsService.getServiceInfo();
66-
// get the first layer's ID
67-
List<WmtsLayerInfo> layerInfos = wmtsServiceInfo.getLayerInfos();
67+
// obtain the read only list of WMTS layer info objects, and select the one with the desired Id value.
68+
List<WmtsLayerInfo> wmtsLayerInfos = wmtsServiceInfo.getLayerInfos();
69+
WmtsLayerInfo layerInfo = wmtsLayerInfos.stream()
70+
.filter(layer -> layer.getId().equals("SRTM_Color_Index")).collect(Collectors.toList()).get(0);
6871
// create the WMTS layer with the LayerInfo
69-
WmtsLayer wmtsLayer = new WmtsLayer(layerInfos.get(0));
72+
WmtsLayer wmtsLayer = new WmtsLayer(layerInfo);
7073
map.setBasemap(new Basemap(wmtsLayer));
7174
} else {
7275
Alert alert = new Alert(Alert.AlertType.ERROR, "Failed to load WMTS layer");

0 commit comments

Comments
 (0)