Skip to content

Commit

Permalink
Merge branch 'main' into 200.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jenmerritt committed Dec 12, 2022
2 parents fbd8702 + c4f1b08 commit f33c85f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ogc/wmts-layer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pan and zoom to explore the WMTS layer, which is displayed automatically.

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

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

## About the data

The map visualizes world time zones.
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.

## Tags

Expand Down
Binary file modified ogc/wmts-layer/WmtsLayer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
package com.esri.samples.wmts_layer;

import java.util.List;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import java.util.stream.Collectors;

import com.esri.arcgisruntime.layers.WmtsLayer;
import com.esri.arcgisruntime.loadable.LoadStatus;
Expand All @@ -31,6 +27,11 @@
import com.esri.arcgisruntime.ogc.wmts.WmtsLayerInfo;
import com.esri.arcgisruntime.ogc.wmts.WmtsService;
import com.esri.arcgisruntime.ogc.wmts.WmtsServiceInfo;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class WmtsLayerSample extends Application {

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

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

0 comments on commit f33c85f

Please sign in to comment.