Products & Services Solutions Academia Support User Community Company

Learn more about Mapping Toolbox   

updateLayers - Class: WebMapServer

Update layer properties

Syntax

[updatedLayer, index] = server.updateLayers(layer)

Description

[updatedLayer, index] = server.updateLayers(layer) returns a WMSLayer array with properties updated with values from the server. The WMSLayer array Layer must contain only one unique ServerURL. The updateLayers method removes layers no longer available on the server. The logical array index contains true for each available layer, such that updatedLayers has the same size as layer(index).

The updateLayers method accesses the Internet to update the properties. Occasionally, a WMS server may be unavailable, or several minutes may elapse before the properties are updated.

Examples

Update the properties of the global_mosaic layer.

layers = wmsfind('global_mosaic', ...
   'SearchField', 'layername', 'MatchType', 'exact');
layer = layers(1);
server = WebMapServer(layer.ServerURL);
updatedLayer = server.updateLayers(layer);
 

Update the properties of layers from multiple servers.

% Find layers with the name 'terra' in 
% the server URL.
terra = wmsfind('terra', 'SearchField', 'serverurl');  
% Find the layers for an individual server in the
% terra layer, update their properties, and append
% them to the updatedTerraLayers array.
servers = terra.servers();
updatedTerraLayers = [];
fprintf('Updating layer properties from %d servers.\n', ...
   numel(servers));
for k=1:numel(servers)
   serverLayers = ...
      terra.refine(servers{k}, 'SearchField', 'serverurl');
   fprintf('Updating properties from server %d:\n%s\n', ...
      k, serverLayers(1).ServerURL);
   server = WebMapServer(serverLayers(1).ServerURL);
   layers = server.updateLayers(serverLayers);
% Grow using concatenation; layers can have any length
% ranging from 0 to numel(serverLayers).
  updatedTerraLayers = [updatedTerraLayers; layers]; 
end
  


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