Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for Qt

WMS layer (URL)

Sample Viewer View Sample on GitHub

Display a WMS layer using a WMS service URL.

Use case

WMS is an OGC standard for displaying maps from images that are dynamically-generated on a web server. WMS is particularly useful for data that changes frequently, contains cartographically complex detail, or requires an open source data standard.

How to use the sample

The map will load automatically when the sample starts.

How it works

  1. Create a WmsLayer specifying the URL of the service and the names of layers you want to display.
    • Note: The name comes from the Name property, not the Title property. On many services, the title is human-readable while the name is a numeric identifier.
  2. Add the layer to the map as an operational layer.

Relevant API

  • Map
  • MapView
  • WmsLayer

About the data

This sample uses a U.S. National Weather Service radar map. Because WMS services generate map images on-the-fly, this layer is always up-to-date with the latest NOAA NEXRAD radar observations.

Tags

OGC, web map service, WmsLayer

Sample Code

import QtQuick 2.6
import Esri.ArcGISRuntime 100.9

Rectangle {
    id: rootRectangle
    clip: true
    width: 800
    height: 600

    MapView {
        id: mapView
        anchors.fill: parent

        Map {
            BasemapLightGrayCanvas {}

            // Add a WMS Layer by specifying the URL and layer name
            WmsLayer {
                url: "https://nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WMSServer?request=GetCapabilities&service=WMS"
                layerNames: ["1"]
            }

            // start zoomed in over the US
            ViewpointExtent {
                Envelope {
                    xMin: -19195297.778679
                    yMin: 512343.939994
                    xMax: -3620418.579987
                    yMax: 8658913.035426
                    SpatialReference {
                        wkid: 3857
                    }
                }
            }
        }
    }
}