| Contents | Index |
Web Map Service map request object
A WMSMapRequest object contains a request to a WMS server to obtain a map, which represents geographic information. The WMS server renders the map as a color or grayscale image. The object contains properties that you can set to control the geographic extent, rendering, or size of the requested map.
mapRequest = WMSMapRequest(layer) constructs a WMSMapRequest object. The WMSLayer array layer contains only one unique ServerURL. The WMSMapRequest class updates the properties of layer, if necessary.
mapRequest = WMSMapRequest(layer, server) constructs a WMSMapRequest object. layer is a WMSLayer object, and server is a scalar WebMapServer object. The ServerURL property of layer must match the ServerURL property of server. The server object updates layer properties.
Server |
Initialized to the Server input, if supplied to the constructor; otherwise constructed using the ServerURL of Layer. Data Type: scalar WebMapServer object |
Layer |
Initialized to the layer input supplied to the constructor. The Layer property contains one unique ServerURL. The Server property updates the properties of Layer when the property is set. The ServerURL property of Layer must match the ServerURL property of Server. Data Type: WMSLayer array |
CoordRefSysCode |
Specifies the coordinate reference system code. Its default value is 'EPSG:4326'. If 'EPSG:4326' is not found in Layer.CoordRefSysCodes, then the CoordRefSysCode value is set from the first CoordRefSysCode found in the Layer.Details.BoundingBox structure array. When CoordRefSysCode is set to 'EPSG:4326' or 'CRS:84', the XLim and YLim properties are set to [] and the Latlim and Lonlim properties are set to the geographic extent defined by the Layer array. When CoordRefSysCode is set to a value other than 'EPSG:4326' or 'CRS:84', then the XLim and YLim properties are set from the values found in the Layer.Details.BoundingBox structure and the Latlim and Lonlim properties are set to []. Automatic projections are not supported. (Automatic projections begin with the string 'AUTO'.) Data Type: string Default: 'EPSG:4326' |
RasterRef |
References the raster map to an intrinsic coordinate system. Data Type: 3-by-2 matrix |
Latlim |
Contains the southern and northern latitudinal limits of the request in units of degrees. The limits must be ascending. Data Type: two-element vector Default: Limits that span all latitudinal limits found in the Layer.Latlim property |
Lonlim |
Contains the western and eastern longitudinal limits of the request in units of degrees. The limits must be ascending and in the range [-180, 180] or [0 360]. Data Type: two-element vector Default: Limits that span all longitudinal limits in the Layer.Lonlim property |
XLim |
Contains the western and eastern limits of the request in units specified by the coordinate reference system. The limits must be ascending. You can set XLim only if you set CoordRefSysCode to a value other than EPSG:4326. Data Type: two-element vector Default: [] |
YLim |
Contains the southern and northern limits of the request in units specified by the coordinate reference system. The limits must be ascending. You can set YLim only if you set CoordRefSysCode to a value other than EPSG:4326. Data Type: two-element vector Default: [] |
ImageHeight |
Specifies the height in pixels for the requested raster map. The property MaximumHeight defines the maximum value for ImageHeight. The WMSMapRequest class initializes the ImageHeight property to either 512 or to an integer value that best preserves the aspect ratio of the coordinate limits, without changing the coordinate limits. Data Type: scalar, positive integer |
ImageWidth |
Specifies the width in pixels for the requested raster map. The property MaximumWidth defines the maximum value for ImageWidth. The WMSMapRequest class initializes the ImageWidth property to either 512 or to an integer value that best preserves the aspect ratio of the coordinate limits, without changing the coordinate limits. Data Type: scalar, positive integer |
Maximum Height |
Contains the maximum height in pixels for the requested map. Cannot be set. The value of MaximumHeight is 8192. Data Type: double |
Maximum Width |
Contains the maximum width in pixels for the requested map. Cannot be set. The value of MaximumWidth is 8192. Data Type: double |
Elevation |
Gives the elevation extent of the requested map. When you set the property, 'elevation' must be the value of the Layer.Details.Dimension.Name field. Data Type: string Default: '' |
Time |
Specifies the time extent of the requested map. See the WMSMapRequest.Time reference page for more information. Data Type: string or double Default: '' |
SampleDimension |
Contains the name of a sample dimension (other than 'time' or 'elevation') and its value. SampleDimension{1} must be the value of the Layer.Details.Dimension.Name field. Data Type: two-element cell array of strings |
Transparent |
Specifies whether the map background is transparent. When you set Transparent to true, the server sets all pixels not representing features or data values in that layer to a transparent value, producing a composite map. When you set Transparent to false, the server sets all non-data pixels to the value of the background color. Data Type: logical scalar Default: false |
BackgroundColor |
Specifies the color of the background (non-data) pixels of the map. The values range from 0 to 255. The default value, [255,255,255], specifies the background color as white. You can set BackgroundColor using non-uint8 numeric values, but they are cast and stored as uint8. Data Type: three-element vector of uint8 values |
StyleName |
Specifies the style to use when rendering the image. The StyleName must be a valid entry in the Layer.Details.Style.Name field. (The cell array of strings contains the same number of elements as does Layer.) Data Type: string or cell array of strings Default: {} |
ImageFormat |
Specifies the desired image format used to render the map as an image. If set, the format must match an entry in the Layer.Details.ImageFormats cell array and an entry in the ImageRenderFormats property. If not set, the format defaults to a value in the ImageRenderFormats property. Data Type: string |
ImageRenderFormats |
Contains the preferred image rendering formats when Transparent is set to false. The first entry is the most preferred image format. If the preferred format is not stored in the Layer property, then the next format from the list is selected, until a format is found. The ImageRenderFormats array is not used if the ImageFormat property is set. The ImageRenderFormats property cannot be set. Data Type: cell array |
ImageTransparentFormats |
Contains the preferred image rendering formats when Transparent is set to true. When Transparent is set to true, the ImageFormat property is set to the first entry in the ImageTransparentFormats list, if it is stored in the Layer property. Otherwise, the list is searched for the next element, until a match is found. If a transparent image format is not found in the list, or if the ImageFormat property is set to a non-default value, then ImageFormat is unchanged. The ImageTransparentFormats property cannot be set. Data Type: cell array |
ServerURL |
Contains the server URL for the WMS GetMap request. In general, ServerURL matches the ServerURL of the Layer. However, some WMS servers, such as the Microsoft TerraServer, require a different URL for GetMap requests than for WMS GetCapabilities requests. Data Type: string Default: Layer(1).ServerURL |
RequestURL |
Contains the URL for the WMS GetMap request. It is composed of the ServerURL with additional WMS parameter/value pairs. This property cannot be set. Data Type: string |
| boundImageSize | Bound size of raster map |
Read a global, half-degree resolution sea surface temperature map for the month of November 2009. The map, from the AMSR-E sensor on NASA's Aqua satellite, uses data provided by NASA's Earth Observations (NEO) WMS server.
sst = wmsfind('AMSRE_SST_M');
server = WebMapServer(sst.ServerURL);
mapRequest = WMSMapRequest(sst, server);
timeRequest = '2009-11-01';
mapRequest.Time = timeRequest;
samplesPerInterval = .5;
mapRequest.ImageHeight = ...
round(abs(diff(sst.Latlim))/samplesPerInterval);
mapRequest.ImageWidth = ...
round(abs(diff(sst.Lonlim))/samplesPerInterval);
mapRequest.ImageFormat = 'image/png';
sstImage = server.getMap(mapRequest.RequestURL);
The legend for the layer can be obtained via the OnlineResource URL field in the LegendURL structure. The legend shows that the temperature ranges from -2 to 35 degrees Celsius. The WMSMapRequest object updates the layer information from the server.
[legend, cmap] = imread...
(mapRequest.Layer.Details.Style(1).LegendURL.OnlineResource);
if isempty(cmap)
legendImg = legend;
else
legendImg = ind2rgb(legend, cmap);
end
Display the temperature map and legend.
figure('Color','white')
worldmap world
setm(gca, 'MlabelParallel', -90, 'MlabelLocation', 90)
geoshow(sstImage, mapRequest.RasterRef);
title({mapRequest.Layer.LayerTitle, timeRequest}, ...
'Interpreter', 'none', 'FontWeight', 'bold')
figurePosition = get(gcf, 'position');
centerWidth = figurePosition(3)/2;
left = centerWidth - size(legendImg,2)/2;
bottom = 30;
width = size(legendImg,2);
height = size(legendImg,1);
axes('Units', 'pixels', 'Position', [left bottom width height])
image(legendImg)
axis off

Additional abstract information for this layer can be obtained from the MetadataURL field.
filename = [tempname '.xml'];
urlwrite(mapRequest.Layer.Details.MetadataURL, filename);
xml = xmlread(filename);
delete(filename);
xml.getElementsByTagName('abstract').item(0).getTextContent
The output appears as shown.
ans = <p>Sea surface temperature is the temperature of the top millimeter of the ocean's surface. Sea surface temperatures influence weather, including hurricanes, as well as plant and animal life in the ocean. Like Earth's land surface, sea surface temperatures are warmer near the equator and colder near the poles. Currents like giant rivers move warm and cold water around the world's oceans. Some of these currents flow on the surface, and they are obvious in sea surface temperature images. Special microwave technology allows the AMSR-E sensor on NASA's Aqua satellite to measure sea surface temperatures through clouds, something no satellite sensor before it was able to do across the whole globe.</p>
WebMapServer | wmsfind | wmsinfo | WMSLayer | wmsread

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |