WMSLayer
Web Map Service layer
Description
A WMSLayer
object describes a Web Map Service (WMS) layer
or layers.
Creation
You can create a WMSLayer
object using any of the following
methods:
wmsfind
— Returns aWMSLayer
array.wmsinfo
— Returns aWMSCapabilities
object, which contains an array ofWMSLayer
objects in itsLayer
property.The
WMSLayer
object creation function, described here.
Description
layers = WMSLayer(
constructs a Name,Value
)WMSLayer
object, where Name
is the name of any property of the WMSLayer
and
Value
is the value that you want to assign to the
property. 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
ServerTitle
— Descriptive information about the server
empty character vector (''
) (default) | character vector
This property is read-only.
Descriptive information about the server, returned as a character vector.
Data Types: char
ServerURL
— URL of WMS Server
empty character vector (''
) (default) | character vector
This property is read-only.
URL of WMS Server, returned as a character vector.
Data Types: char
LayerTitle
— Descriptive information about the layer
empty character vector (''
) (default) | character vector
This property is read-only.
Descriptive information about the layer, returned as a character vector.
The LayerTitle
clarifies the meaning of the raster values
of the layer.
Data Types: char
LayerName
— Keyword the server uses to retrieve the layer
empty character vector (''
) (default) | character vector
This property is read-only.
Keyword the server uses to retrieve the layer, returned as a character vector.
Data Types: char
Latlim
— Latitude limits of the layer in units of degrees
[]
(default) | two-element numeric vector
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
Lonlim
— Longitude limits of the layer in units of degrees
[]
(default) | two-element numeric vector
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
Abstract
— Information about the layer
empty character vector (''
) (default) | character vector
This property is read-only.
Information about the layer, returned as a character vector.
Data Types: char
CoordRefSysCodes
— Codes identifying available coordinate reference systems
empty cell array {}
(default) | cell array of character vectors
This property is read-only.
Codes identifying available coordinate reference systems, returned as a cell array of character vectors.
Data Types: cell
Details
— Detailed information about the layer
structure
This property is read-only.
Detailed information about the layer, returned as a structure containing these fields:
Field | Description |
---|---|
MetadataURL | URL containing metadata information about the layer, returned as a character vector. |
Attributes | Attributes of the layer, returned as a structure array containing these fields.
|
BoundingBox | Bounding box of the layer, returned as a structure array containing these fields.
|
Dimension | Dimension parameters, returned as a structure array containing these fields. Examples of dimensions include time, elevation, and temperature.
|
ImageFormats | Image formats supported by the server, returned as a cell array of character vectors. |
ScaleLimits | Scale limits of the layer, returned as a structure containing these fields.
|
Style | Style parameters that determine layer rendering, returned as a structure array containing these fields.
|
Version | WMS version specification, returned as a character vector. |
Data Types: struct
Object Functions
disp | Display properties of WMS layers or capabilities |
refine | Refine search of WMS layers |
refineLimits | Refine search of WMS layers based on geographic limits |
servers | Return URLs of unique WMS servers |
serverTitles | Return titles of unique WMS servers |
Examples
Create WMS Layer from WMS GetMap Request URL
Specify the URL of a WMS server. You can typically find the host and path components of the URL via an internet search.
host = "www.mrlc.gov"; path = "/geoserver/NLCD_Land_Cover/wms?"; serverURL = "https://" + host + path;
Specify the name of the layer. You can typically find the name of a layer via an internet search.
layerName = "mrlc_display:NLCD_2016_Land_Cover_L48";
Create the WMS layer from the URL of the WMS server and the layer name.
layer = WMSLayer(ServerURL=serverURL,LayerName=layerName);
Synchronize the layer with the server by using the wmsupdate
function. Valid WMS layers have longitude limits in the range [–180, 180] or [0, 360]. Specify valid longitude limits for the layer by changing the Lonlim
property.
layer = wmsupdate(layer); layer.Lonlim = [-180 180];
Read an image from the WMS server by using the wmsread
function. Specify the latitude and longitude limits using the Latlim
and Lonlim
name-value arguments. Specify the height and width of the image using the ImageHeight
and ImageWidth
name-value arguments.
lonlim = [-128 -65]; latlim = [23 51]; height = 470; width = 1024; [A,R] = wmsread(layer,Latlim=latlim,Lonlim=lonlim,ImageHeight=height,ImageWidth=width);
Display the image from the server.
figure
usamap(A,R)
geoshow(A,R)
title("NLCD Land Cover")
You can also read the image by specifying a WMS GetMap request URL. Note that the URL contains the layer name in the LAYERS
parameter, the latitude and longitude limits in the BBOX
parameter, and the size of the image in the WIDTH
and HEIGHT
parameters.
requestURL = serverURL + "SERVICE=WMS&FORMAT=image/jpeg&REQUEST=GetMap&" + ... "STYLES=&SRS=EPSG:4326&VERSION=1.1.1&LAYERS=mrlc_display:NLCD_2016_Land_Cover_L48&" + ... "WIDTH=1024&HEIGHT=470&BBOX=-128,23,-65,51"; [A,R] = wmsread(requestURL);
Version History
Introduced in R2009b
See Also
Functions
Objects
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)