Main Content

wmsinfo

Read capabilities document from WMS server

    Description

    capabilities = wmsinfo(url) reads the capabilities document capabilities from the Web Map Service (WMS) server URL or information request URL specified by url. A capabilities document is an XML document that describes the geographic content the server offers.

    The wmsinfo function requires an internet connection. WMS servers can periodically be unavailable. Reading the capabilities document can take several minutes.

    [capabilities,infoRequestURL] = wmsinfo(url) additionally returns the information request URL infoRequestURL.

    example

    [___] = wmsinfo(url,"TimeoutInSeconds",sec) specifies the number of seconds to wait before timing out.

    Examples

    collapse all

    Read the capabilities document and information request URL from the NASA Goddard Space Flight Center WMS server.

    url = "https://svs.gsfc.nasa.gov/cgi-bin/wms?"; 
    [capabilities,infoRequestURL] = wmsinfo(url);

    View the information request URL, which is the server URL with additional WMS parameters.

    infoRequestURL
    infoRequestURL = 
    'https://svs.gsfc.nasa.gov/cgi-bin/wms?REQUEST=GetCapabilities&VERSION=1.3.0&SERVICE=WMS'
    

    Display information about the first layer in the capabilities document.

    layers = capabilities.Layer;
    layers(1)
    ans = 
      WMSLayer
    
      Properties:
               Index: 1
         ServerTitle: 'NASA SVS Image Server'
           ServerURL: 'https://svs.gsfc.nasa.gov/cgi-bin/wms?'
          LayerTitle: 'African Fires During 2002 (1024x1024 Animation)'
           LayerName: '2890_17402'
              Latlim: [-39.0000 41.0000]
              Lonlim: [-22.0000 58.0000]
            Abstract: 'This animation shows fire activity in Africa from January 1, 2002 to December 31, 2002. The fires are shown as tiny particles with each particle depicting the geographic region in which fire was detected. The color of a particle represents the number of days since a sizable amount of fire was detected in that region, with red representing less than 20 days, orange representing 20 to 40 days, yellow representing 40 to 60 days, and gray to black representing more than 60 days. This data was measured by the MODIS instrument on the Terra satellite. MODIS detects fires by measuring the brightness temperature of a region in several frequency bands and looking for hot spots where this temperature is greater than the surrounding region.
    
    Additional Credit:
    B>Please give credit for this item to:</b><br />'
    CoordRefSysCodes: {'CRS:84'}
             Details: [1x1 struct]
    
      Methods
    
    

    Refine the layers in the capabilities document to include only layers with the term "glacier retreat" in the title.

    glaciers = refine(layers,"glacier retreat","SearchFields","LayerTitle");

    Display the title of the first refined layer.

    glaciers(1).LayerTitle
    ans = 
    'Jakobshavn Glacier Retreat (2048x512 Animation)'
    

    Input Arguments

    collapse all

    WMS server URL or information request URL, specified as a string scalar or a character vector.

    • A WMS server URL contains the protocol "http://" or "https://" and WMS access keywords.

    • An information request URL contains the WMS server URL and additional WMS parameters, such as the request type and version. An information request URL is also known as a get capabilities request URL.

    Example: "http://svs.gsfc.nasa.gov/cgi-bin/wms?'" is a server URL.

    Example: "http://svs.gsfc.nasa.gov/cgi-bin/wms?REQUEST=GetCapabilities&VERSION=1.3.0&SERVICE=WMS" is an information request URL.

    Data Types: char | string

    Time out connection duration in seconds, specified as a nonnegative integer. The value is the number of seconds to wait to receive a response from the server. To deactivate the time out mechanism, specify this argument as 0.

    Data Types: double

    Output Arguments

    collapse all

    Capabilities document, returned as a WMSCapabilities object.

    Information request URL, returned as a character vector. This argument contains the WMS server URL and additional WMS parameters, such as the request type and version. This argument can contain different WMS parameters than you specify in url.

    View the capabilities document as an XML document by opening the returned URL in a browser. Alternatively, view the XML document in MATLAB® by passing this argument to the webread function.

    Algorithms

    The wmsinfo function communicates with the WMS server by using a WebMapServer object that represents an implementation of a WMS specification. The object acts as a proxy to the WMS server, resides physically on the client side, accesses the capabilities document for the server, and uses the highest known WMS version that the server supports.

    Version History

    Introduced in R2009b

    expand all