Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

wmsfind

Search local database for Web map servers and layers

Syntax

layers = wmsfind(querystr)
layers = wmsfind(querystr, Name,Value,...)

Description

layers = wmsfind(querystr) searches the fields of the installed Web Map Service (WMS) Database for partial matches of querystr, which is a character vector, cell array of character vectors, string, or array of strings. By default, wmsfind searches the Layer or LayerName properties but you can include other fields in the search using the SearchFields parameter. querystr can contain the wildcard character '*'.

The WMS database contains the following searchable fields:

FieldData TypeContent
LayerTitlecharacter vectorTitle of layer
LayerNamecharacter vectorName of layer
ServerTitlecharacter vectorTitle of server
ServerURLcharacter vectorURL of server
Latlimtwo-element numeric vectorlatitude limits of the layer in the form [southern northern]
Lonlimtwo-element numeric vectorlongitude limits of the layer in the form [western eastern]

wmsfind searches the installed WMS database, by default, but you can specify a custom database—see the Version parameter. The information found in the database is static and is not automatically updated—it was validated at the time of the software release.

wmsfind returns layers, an array of WMSLayer objects containing one object for each layer whose name or title partially matches querystr. WMS servers produce maps of spatially referenced raster data, such as temperature or elevation, that are known as layers.

layers = wmsfind(querystr, Name,Value,...) modifies the search of the WMS database based on the values of the parameters. You can abbreviate parameter names, and case does not matter.

Input Arguments

collapse all

Characters to search for in WMS database fields, specified as a character vector, cell array of character vectors, string, or array of strings. querystr can contain the asterisk wildcard character (*).

Example: 'temperature'

Data Types: char | cell | string

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

collapse all

Ignore case when comparing field values to querystr, specified as the logical value true or false.

Data Types: logical

Latitudinal limits of the search, specified as a two-element vector of the form [southern_limit northern_limit] or a scalar value representing the latitude of a single point. Values are in the range [-90, 90]. 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.

Data Types: double | int16 | int32 | int64 | int8 | single | uint8 | uint16 | uint32 | uint64

Longitudinal limits of the search, specified as a two-element vector of the form [western_limit eastern_limit] or 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 fully contain the specified 'Lonlim' limits. Partial overlap does not result in a match.

Data Types: double | int16 | int32 | int64 | int8 | single | uint8 | uint16 | uint32 | uint64

Strictness of match, specified as the character vector or string 'partial' or 'exact'. If 'MatchType' is 'exact' and querystr is '*', a match occurs when the search field matches the character '*'.

Data Types: char | string

Fields to search in the WMS database, specified as a character vector, cell array of character vectors, string, or array of strings. The function searches the values of the specified fields in the WMS database for a partial or exact match with querystr. The following table lists valid values.

FieldBehavior
'layername'Search the LayerName field in the WMS database. The layer name is an abbreviated form of the LayerTitle field and is the keyword the server uses to retrieve the layer.
'layertitle'Search the LayerTitle field in the WMS database. The layer title includes descriptive information about a layer and facilitates understanding the meaning of the raster values of the layer.
'layer'Search both the LayerTitle and the LayerName fields.
'servertitle'Search the ServerTitle field in the WMS database. A server title includes descriptive information about the server.
'serverurl'Search the ServerURL field in the WMS database. The server URL and layer information facilitate the reading of raster layers by the function wmsread.
'server'Search both the ServerTitle and the ServerURL fields.
'any'Search all fields.

Data Types: char | cell | string

Version of the WMS database to read, specified as one of the following character arrays.

ValueDescription
'custom'Read from the wmsdatabase.mat file on the MATLAB path.
'installed'Read from the installed database.

Data Types: char | string

Output Arguments

collapse all

Layers that match search criteria, returned as an array of WMSLayer objects, one for each layer found.

Examples

collapse all

Search the Entire WMS Database

Search the WMS database for layers that contain the word "temperature". The wmsfind function returns an array of WMSLayer objects.

layers = wmsfind('temperature');

Find layers that contain global temperature data. The query includes the asterisk wildcard character '*'.

layers = wmsfind('global*temperature');

Search Specific Fields in the WMS Database

Search the LayerTitle field for all layers that contain an exact match for the term 'Rivers'. You must use the MatchType parameter to specify an exact match.

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

Search the LayerName field for all layers that contain a partial match for 'elevation'. By default, wmsfind searches for partial matches.

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

Search the LayerName field for all unique servers that contain 'BlueMarbleNG'.

layers = wmsfind('BlueMarbleNG','SearchFields','layername', ...
                 'MatchType','exact');
urls = servers(layers);

Limit Your Search to Specific Geographic Regions

Find layers that contain elevation data for Colorado. Use the Latlim and Lonlim parameters to specify the location.

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

Find all layers that contain temperature data for a point in Perth, Australia. Use the Latlim and Lonlim parameters to specify the location.

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

Find all the layers provided by servers located at the Jet Propulsion Laboratory (JPL).

layers = wmsfind('jpl.nasa.gov','SearchFields','serverurl');

Find all the unique URLs of all government servers.

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

Search Multiple Fields at the Same Time and Refine Your Search

Search both the LayerTitle and the LayerName fields for all the layers that contain the word "temperature".

fields = [string('layertitle') string('layername')];
temperature = wmsfind('temperature','SearchFields',fields);

Refine the results of your temperature search to find only those layers that deal with sea surface temperatures. Use the WMSLayer object refine method.

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

Refine your sea surface temperature search further to find only those layers that deal with global sea surface temperatures.

global_sst = refine(sst,'global');

Search the Entire WMS Database and Progressively Refine Your Search

Note that finding all the layers from the WMS database may take several seconds to execute and require a substantial amount of memory. The database contains more than 100,000 layers.

Find all the layers in the WMS database and sort them into a set that comprises only the unique layer titles.

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

Refine your original search, layers, to include only those layers with global coverage. Use the WMSLayer object refineLimits method.

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

Refine the results of your global layers search to contain only layers with global extent that include the word "topography". Use the WMSLayer object refine method.

global_topography_layers = refine(global_layers,'topography');

Refine your original search, layers, to contain only layers that have some combination of the terms "oil" and "gas" in the LayerTitle field.

oil_gas_layers = refine(layers,'oil*gas','SearchFields','layertitle');

More About

collapse all

Tips

  • TheWMSLayer objects returned by wmsfind contain properties with the same names as the field names of the WMS database, along with three additional properties: 'Abstract', 'CoordRefSysCodes', and 'Details'. The WMS database does not contain information about these properties. To get this information about a server, you must use the wmsupdate function which updates these properties of the WMSLayer object by downloading information from the server. To view these properties, use the WMSLayer.disp method, specifying the 'Properties' parameter value 'all'. If you want to know more about a WMS server, use the wmsinfo function with the specific server URL.

Introduced in R2009b

Was this topic helpful?