Main Content


Return URLs of unique WMS servers



serverURLs = servers(layers) returns the URLs of unique servers associated with Web map service layers, layers.


collapse all

Search the WMS Database for government servers. Set the unique URLs to a variable.

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

Search the WMS Database for servers that contain information about clouds. Set the unique server URLs to a variable.

temperature = wmsfind('clouds');
serverURLs = servers(temperature);

Display the server URLs and the number of layers that reference the URL.

for k=1:numel(serverURLs)
   querystr = serverURLs{k};
   layers = refine(temperature,querystr, ...
      'SearchFields', 'serverurl');
   fprintf('Server URL\n%s\n', layers(1).ServerURL);
   fprintf('Number of layers: %d\n\n', numel(layers));
Server URL
Number of layers: 2
Server URL
Number of layers: 1
Server URL
Number of layers: 8

Your results might be different because the WMS Database changes each release.

Input Arguments

collapse all

Layers to provide server URLs, specified as an array of WMSLayer objects.

Output Arguments

collapse all

URLs of unique servers, returned as a cell array of character vectors.

Version History

Introduced in R2009b