View on GitHub Sample viewer app

Display a layer from a Web Map Tile Service.

Image of WMTS layer

Use case

WMTS services can have several layers. You can use ArcGIS Maps SDKs for Native Apps to explore the layers available from a service. This would commonly be used to enable a browsing experience where users can choose which layers they want to display at run time.

How to use the sample

Pan and zoom to explore the WMTS layer, which is displayed automatically.

How it works

  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. Create a new WmtsLayer from a WmtsLayerInfo
  4. Set it as the map’s basemap with map.setBasemap(new Basemap(wmtsLayer)).

Relevant API

  • WmtsLayer
  • WmtsLayerInfo
  • WmtsService
  • WmtsServiceInfo

About the data

We acknowledge the use of imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System (ESDIS) 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

layer, OGC, raster, tiled, web map tile service

Sample Code

module-info.java module-info.java WmtsLayerSample.java
/*
* Copyright 2022 Esri.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module com.esri.samples.wmts_layer {
// require ArcGIS Maps SDK for Java module
requires com.esri.arcgisruntime;
// handle SLF4J http://www.slf4j.org/codes.html#StaticLoggerBinder
requires org.slf4j.nop;
// require JavaFX modules that the application uses
requires javafx.graphics;
requires javafx.controls;
exports com.esri.samples.wmts_layer;
}