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
Construct WMSLayer Object from WMS GetMap Request URL
Specify the server URL. These values are typically found during an Internet search. The WMSLayer ServerURL
value is obtained from the host and path of the request URL. The WMSLayer LayerName
value is obtained from the LAYERS
value in the query part of the URL.
host = 'www.mrlc.gov'; path = '/geoserver/NLCD_Land_Cover/wms?'; serverURL = ['https://' host path]; 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']; layerName = 'mrlc_display:NLCD_2016_Land_Cover_L48';
Construct the WMSLayer
object by using the serverURL
variable and the value of the WMS LAYERS
parameter.
layer = WMSLayer('ServerURL',serverURL,'LayerName',layerName);
Use the wmsupdate
function to get the other properties of the WMSLayer array from the server.
layer = wmsupdate(layer); layer.Lonlim = [-180 180];
Retrieve an image from the WMS server using layer and parameter values from the WMS GetMap
request URL. Set latitude and longitude limits from the BBOX
request value. Set image height and width values from the WIDTH
and HEIGHT
request values.
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')
This image can also be retrieved using the WMS requestURL
.
[A,R] = wmsread(requestURL);
Version History
Introduced in R2009b
See Also
Functions
Objects
Abrir ejemplo
Tiene una versión modificada de este ejemplo. ¿Desea abrir este ejemplo con sus modificaciones?
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
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)