www.gusucode.com > map 案例源码 matlab代码程序 > map/SearchTheWMSDatabaseForLayersExample.m
%% Search the WMS Database for Layers % %% 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');