Products & Services Solutions Academia Support User Community Company

Learn more about Mapping Toolbox   

wmsfind - Search local database for Web map servers and layers

Syntax

layers = wmsfind(querystr)
layers = wmsfind(..., param, val, ...)

Description

layers = wmsfind(querystr) searches the LayerTitle and LayerName fields of the installed Web Map Service (WMS) Database for partial matches with the string querystr. WMS servers, by definition, produce maps of spatially referenced raster data. You can search for specific types of data, known as layers, such as temperature or elevation. The string querystr can contain the wildcard character '*'.

The array returned by wmsfind, layers, contains one element for each layer whose name or title partially matches querystr. Each element is a WMSLayer object. The installed WMS Database contains a subset of these fields (ServerTitle, ServerURL, LayerTitle, LayerName, Latlim, and Lonlim). The information found in the database is static and is not automatically updated; it was validated at the time of the software release.

layers = wmsfind(..., param, val, ...) modifies the search of the WMS database based on the values of the parameters. You can abbreviate parameter names, and case does not matter. To modify the search, specify any of the parameters listed in the Inputs section.

The WMS Database does not store content for the properties 'Abstract', 'CoordRefSysCodes', and 'Details'. Therefore, you cannot use wmsfind to search these properties. Populate these fields by using the wmsupdate function. This function updates these properties by downloading information from the server. The WMSLayer.disp method does not automatically display these unpopulated properties. Set the WMSLayer.disp 'Properties' parameter to 'all' to view. After you have viewed the information available from wmsupdate, if you still want to know more about the WMS server, use the function wmsinfo with the specific server URL.

Inputs

querystr

Specifies the search string, such as 'temperature'

Data Type: string

param, val

Modifies the search. Parameter names and values are shown below.

ParameterData TypeValue
'IgnoreCase'Logical

Specifies whether to ignore case when performing string comparisons. Possible values are true or false; the default value is true.

'Latlim'Two-element vector or scalar

A two-element vector of latitude specifying the latitudinal limits of the search in the form [southern_limit northern_limit] or a scalar value representing the latitude of a single point. All angles are in units of degrees.

If provided and not empty, a given layer appears in the results only if its limits fully contain the specified 'Latlim' limits. Partial overlap does not result in a match.

'Lonlim'Two-element vector or scalar

A two-element vector of longitude specifying the longitudinal limits of the search in the form [western_limit eastern_limit] or a scalar value representing the longitude of a single point. All angles are in units of degrees.

If provided and not empty, a given layer appears in the results only if its limits contain the specified 'Lonlim' limits. Partial overlap does not result in a match.

'MatchType'String

Has value 'partial' or 'exact'. For a partial string match, specify 'partial' for the 'MatchType'. For an exact match, specify 'exact'. If 'MatchType' is 'exact' and querystr is '*', a match occurs when the search field matches the character '*'. The default value is 'partial'.

'SearchFields'String or cell array of strings

Valid strings are 'layer', 'layertitle', 'layername', 'server', 'serverurl', 'servertitle', or 'any'.

The function searches the entries in the 'SearchFields' of the WMS database for a partial match with querystr. If 'layer' is supplied, then both the 'layertitle' and 'layername' fields are searched. If 'server' is supplied, then both the 'serverurl' and 'servertitle' fields are searched. The layer information is returned if any supplied 'SearchFields' match. The default value is {'layer'}.

Examples

1. Using Basic Syntax

Find layers that contain temperature data and return a WMSLayer array.

layers = wmsfind('temperature');

2. Specifying Your Search

Find all layers that contain global temperature data and return a WMSLayer array.

layers = wmsfind('global*temperature');

3. Returning an Exact Match

Find all layers that contain an exact match for 'Major Rivers' in the LayerTitle field and return a WMSLayer array.

layers = wmsfind('Major Rivers', 'MatchType', 'exact', ...
   'IgnoreCase', false, 'SearchFields', 'layertitle');

4. Returning a Partial Match

Find all layers that contain a partial match for 'elevation' in the LayerName field and return a WMSLayer array.

layers = wmsfind('elevation', 'SearchField', 'layername');

5. Searching by Layer Name

Find all unique servers that contain 'global_mosaic' as a layer name.

layers = wmsfind('global_mosaic', ...
   'SearchField', 'layername', 'MatchType', 'exact');
servers = layers.servers;

6. Finding Elevation for a Region

Find layers that contain elevation data for Colorado and return a WMSLayer array.

latlim = [35,43];
lonlim = [-111,-101];
layers = wmsfind('elevation', ...
   'Latlim', latlim, 'Lonlim', lonlim);

7. Finding Elevation for a Specific Point

Find all layers that contain temperature data for a point in Perth, Australia, and return a WMSLayer array.

lat = -31.9452;
lon = 115.8323;
layers = wmsfind('temperature', 'Latlim', lat, 'Lonlim', lon);

8. Display Layer Properties

Find all layers provided by the Jet Propulsion Laboratory (JPL) server and display to the command window each layer title and layer name.

layers = wmsfind('jpl.nasa.gov', 'SearchField', 'serverurl');
layers.disp('Properties', {'layerTitle', 'layerName'});

9. Finding URLs of a Certain Type

Find all unique URLs of government servers.

layers = wmsfind('*.gov*', 'SearchField', 'serverurl');
servers = layers.servers;

10. Refining a Search

Perform multiple searches. Find all layers that contain temperature in the layer name or title fields.

temperature = wmsfind('temperature', ...
   'SearchField',{'layertitle', 'layername'});

Find sea surface temperature layers.

sst = temperature.refine('sea surface');

Find and display to the command window a list of global sea surface temperature layers.

global_sst = sst.refine('global')

11. Refining a Search of the Entire Database

Perform multiple searches and listings of the entire WMS Database. Please note that finding all layers from the WMS Database takes several minutes to execute. There are over 300,000 layers in the WMS Database.

layers = wmsfind('*');

Sort and display to the command window the unique layer titles in the WMS database.

layerTitles = sort(unique({layers.LayerTitle}))'

Refine layers to include only layers with global coverage.

global_layers = layers.refineLimits('Latlim', [-90 90], ...
   'Lonlim', [-180 180]);

Refine global_layers to contain only topography layers that have global extent.

topography = global_layers.refine('topography');

Refine layers to contain only layers that have the terms "oil" and "gas" in the LayerTitle.

oil_gas = layers.refine('oil*gas', 'SearchField', 'layertitle');

See Also

wmsinfo | wmsread | wmsupdate

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS