Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

WMSLayer class

Web Map Service layer object

Description

A WMSLayer object describes a Web Map Service (WMS) layer or layers.

You can create a WMSLayer object using any of the following methods:

  • wmsfind — Returns a WMSLayer array.

  • wmsinfo — Returns a WMSCapabilities object, which contains an array of WMSLayer objects in its Layer property.

  • WMSLayer class constructor.

Construction

layers = WMSLayer(Name,Value,...) constructs a WMSLayer object, where Name is the name of a property of the WMSLayer class and Value is the value that you want to assign to the property. Name can be any of the properties of the WMSLayer class. You can specify several name-value pair arguments in any order as Name1,Value1,...,NameN,ValueN. The size of the output layers is scalar unless all inputs are cell arrays, in which case, the size of layers matches the size of the cell arrays.

Properties

expand all

Descriptive information about the server, specified as a character vector.

Data Types: char

URL of WMS Server, specified as a character vector.

Data Types: char

Descriptive information about the layer, specified as a character vector. The LayerTitle clarifies the meaning of the raster values of the layer.

Data Types: char

Keyword the server uses to retrieve the layer, specified as a character vector.

Data Types: char

Latitude limits of the layer in units of degrees, specified as a two-element numeric vector. The limits specify the southern and northern latitude limits and must be in units of degrees and in the range [-90, 90].

Data Types: double

Longitude limits of the layer in units of degrees, specified as a two-element numeric vector. The limits specify the western and eastern longitude limits and must be ascending and in the range [-180, 180] or [0 360].

Data Types: double

Information about the layer, specified as a character vector.

Data Types: char

Codes identifying available coordinate reference systems, specified as a cell array of character vectors.

Data Types: cell

Detailed information about the layer, specified as a structure containing: MetadataURL, Attributes, Scale, Dimension, Style. See the WMSLayer.Details reference page for more information.

Data Types: struct

Methods

dispDisplay properties
refineRefine search
refineLimitsRefine search based on geographic limits
serversReturn URLs of unique servers
serverTitlesReturn titles of unique servers

Examples

expand all

Specify the server URL.

serverURL = ['http://ims.cr.usgs.gov:80/wmsconnector/' ...
    'com.esri.wms.Esrimap/USGS_EDC_LandCover_NLCD2001?'];
requestURL = [serverURL 'SERVICE=WMS&FORMAT=image/jpeg&' ...
    'REQUEST=GetMap&' ...
    'STYLES=&SRS=EPSG:4326&VERSION=1.1.1&', ...
    'LAYERS=NLCD_2001_Land_Cover&', ...
    'WIDTH=1024&HEIGHT=470&' ...
    'BBOX=-128,23,-65,51&'];

Construct the WMSLayer object by using the serverURL variable and the value of the WMS LAYERS parameter. Update the remaining information from the server.

layer = WMSLayer('ServerURL', serverURL, ...
    'LayerName', 'NLCD_2001_Land_Cover');
layer = wmsupdate(layer)

Request the layer from the server using the WMS request parameters found in the requestURL string. Copy the WMS BBOX information to the latlim and lonlim parameters. Copy the WMS WIDTH and HEIGHT values to the ImageWidth and ImageHeight parameters.

lonlim = [-128, -65];
latlim = [23, 51];
[A, R] = wmsread(layer, 'Latlim', latlim, 'Lonlim', lonlim, ...
    'ImageHeight', 470 , 'ImageWidth', 1024);

Display the rendered image.

figure
usamap(A, R)
geoshow(A, R)
title(layer.LayerTitle, 'Interpreter', 'none')

The image can also be retrieved using the requestURL.

[A, R] = wmsread(requestURL);

Related Examples

Introduced in R2009b

Was this topic helpful?