Main Content

WebMapServer

Web map server

Description

A WebMapServer object represents a Web Map Service (WMS) and acts as a proxy to a WMS server.

The WebMapServer object resides physically on the client side. The object can access the capabilities document on the WMS server and perform requests to obtain maps. It supports multiple WMS versions and negotiates with the server automatically to use the highest known version that the server can support.

Creation

Description

example

server = WebMapServer(serverURL) creates a WebMapServer object, setting the ServerURL property.

Properties

expand all

Number of milliseconds before a server times out, specified as a nonnegative integer. When Timeout has a value of 0, the WebMapServer object ignores the timeout mechanism.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Flag enabling cache, specified as a logical scalar. When EnableCache is True, the WebMapServer object caches the WMSCapabilities object, which is returned when you use the getCapabilities method. The cache expires if the AccessDate property of the cached WMSCapabilities object is not the current day.

Data Types: logical

URL of the server, specified as a character vector. The URL must include the protocol 'http://' or 'https://'. The URL can contain additional WMS keywords.

Data Types: char

URL of the last request to the server, specified as a character vector. RequestURL specifies a request for either the XML capabilities document or a map. You can insert the requested URL into a browser.

Data Types: char

Object Functions

getCapabilities Get capabilities document from server
getMapGet raster map from server
updateLayersUpdate layer properties

Examples

collapse all

Construct a WebMapServer object that communicates with one of the Environmental Research Division's Data Access Program (ERDDAP) WMS servers hosted by NOAA. Obtain the capabilities document from the server.

layers = wmsfind("NOAA_DHW","SearchField","serverurl");
serverURL = layers(1).ServerURL;
server = WebMapServer(serverURL);
capabilities = getCapabilities(server);
layers = capabilities.Layer;

Search for a server that shows nation boundaries (nations). Search for a server that provides daily, global sea surface temperature (sst) data.

nations = refine(layers,"nations");
nations = nations(1);
sst = refine(layers,"sst");
sst = sst(1);
layer = [sst nations];

Obtain the data from the servers.

request = WMSMapRequest(layer,server);
A = getMap(server,request.RequestURL);
R = request.RasterReference;

Display the data on a map.

figure
worldmap(A,R)
geoshow(A,R)
plabel off
mlabel off

layerTitle = string(sst.LayerTitle);
layerTitle = textwrap(layerTitle,65);
layerTitle = [layerTitle; sst.Details.Dimension.Default];
title(layerTitle,"Interpreter","none")

Version History

Introduced before R2006a