Explore Other Layers using a Capabilities Document

You may find a layer you like in the WMS Database and then want to find other layers on the same server.

  1. Use the wmsinfo function to return the contents of the capabilities document as a WMSCapabilities object. A capabilities document is an XML document containing metadata describing the geographic content offered by a server.

    serverURL = 'http://svs.gsfc.nasa.gov/cgi-bin/wms?';
    capabilities = wmsinfo(serverURL)
    
    capabilities = 
    
      WMSCapabilities
    
      Properties:
             ServerTitle: 'NASA SVS Image Server'
               ServerURL: 'http://svs.gsfc.nasa.gov/cgi-bin/wms?'
             ServiceName: 'WMS'
                 Version: '1.3.0'
                Abstract: 'Web Map Server maintained by the 
                           Scientific Visualization 
                           Studio at NASA's Goddard Space Flight Center'
          OnlineResource: 'http://svs.gsfc.nasa.gov/'
      ContactInformation: [1x1 struct]
       AccessConstraints: 'none'
                    Fees: 'none'
             KeywordList: {}
            ImageFormats: {'image/png'}
              LayerNames: {326x1 cell}
                   Layer: [326x1 WMSLayer]
              AccessDate: '09-Jan-2017'
    
      Methods
  2. View the layer names and layer titles.

    capabilities.LayerNames;
    
    layerTitles = {capabilities.Layer.LayerTitle}';
  3. Read the layer containing tropospheric ozone impacts.

    layerTitle = 'Tropospheric Ozone Impacts Global Climate Warming';
    layer = refine(capabilities.Layer, layerTitle);
    [A, R] = wmsread(layer);
    
  4. Display the map.

    figure
    worldmap(A,R)
    geoshow(A,R)
    title(layer.LayerTitle)
    

  5. This layer contains data from different years. You can examine the available data by viewing the layer.Details.Dimension structure.

    layer.Details.Dimension
    
  6. Display the map for the year 1884 and compare it with the map for 1994, the default year (displayed previously).

    year = '1884';
    [A2,R] = wmsread(layer,'Time',year);
    figure
    worldmap(A2,R)
    geoshow(A2,R)
    title({layer.LayerTitle, year})
    

See Also

| |

Related Topics