refine

Class: WMSLayer

Refine search

Syntax

refine(layers,querystr,Name,Value,...)

Description

refine(layers,querystr,Name,Value,...) searches for elements of layers in which values of the Layer or LayerName properties match the string querystr. Use the 'MatchType' parameter to control whether the method uses partial or exact matching. The default is partial matching.

Input Arguments

layers

Web Map Service layer object

querystr

Specifies the search 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.

'SearchFields'

Case-insensitive string or cell array of strings. Valid strings are 'abstract', 'layer', 'layertitle', 'layername', 'server', 'serverurl', 'servertitle', or 'any'.

Default: {'layer'}

'MatchType'

Case-insensitive string with value 'partial' or 'exact'. If you specify 'MatchType' as 'partial', then a match is determined if the query string is found in the property value. If you specify 'MatchType' as 'exact', then a match is determined only if the query string exactly matches the property value. If you specify 'MatchType' as 'exact' and querystr as '*', a match is found if the property value matches the character '*'.

Default: 'partial'

'IgnoreCase'

Logical. If you set 'IgnoreCase' to true, then WMSLayer.refine ignores case when performing string comparisons.

Default: true

Tips

  • The WMSLayer.refine method searches the entries in the 'SearchFields' properties of layers for a partial match of the entry with querystr. The WMSLayer.refine method returns layer information if any supplied 'SearchFields' match. If you specify 'layer', then the method searches both the 'LayerTitle' and 'LayerName' properties. If you specify 'server', then the method searches both the 'ServerURL' and 'ServerTitle' fields. If you specify 'any', then the method searches the properties 'Abstract', 'LayerTitle', 'LayerName', 'ServerURL', and 'ServerTitle'.

Examples

Refine a search of temperature layers to find two different sets of layers: (1) layers containing only annual sea surface temperatures, and (2) layers containing annual temperatures or sea surface temperatures.

temperature = wmsfind('temperature');
annual = refine(temperature,'annual');
sst = refine(temperature,'sea surface');
annual_and_sst = refine(sst,'annual');
annual_or_sst = [sst;annual];

See Also

Was this topic helpful?