Previous IDL Reference Guide: Network Objects Next

IDLnetOGCWMS::GetLayers

Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also

The IDLnetOGCWMS::GetLayers function method provides access to the layer details that were returned and parsed by the IDLnetOGCWMS::GetCapabilities method. You can return information for all layers or a subset of the layers, which can be useful when:

Syntax

Result = Obj->[IDLnetOGCWMS::]GetLayers ([, COUNT=variable], [, NUMBER=value] [, INDEX=value])

Return Value

The return value is an array of structures containing one or more layers. Use the COUNT keyword to verify that layers are available since the returned value can be zero when layers are not available. The layer structure contains single values, arrays of strings, and structures.

Layer Structure

The layer structure is complex. Some elements in the main structure return other structures as shown in the following figure. Click on the names of any of the structures in the boxes to go to the associated reference section.

Figure 9-2: Layer Structure and Sub-structures

Figure 9-2: Layer Structure and Sub-structures

Main Layer Structure

The following table contains a list of tags found in the main level Layer structure. All items return string values unless otherwise noted. All tags are valid in versions 1.1.1 and 1.3.0 unless otherwise noted.

Table 9-21: Layer Structure 

Table 9-21: Layer Structure 
Field Name
Description
LAYER
Contains the zero-based layer number as a convenience. Layers are numbered sequentially as they are encountered in the XML file returned by GetCapabilities. This value is generated by IDL.
PARENT
Contains the layer number of the parent of this child level as a convenience. If the layer is at the root level, the value is -1. This value is generated by IDL.
LEVEL
Contains the nesting level of the layer as a convenience. Layers at the root level have a LEVEL value of 1, children of the root level have a value of 2. This value increases with increasing nesting level and is generated by IDL.
VERSION
1.1.1 XML source: 
<WMT_MS_Capabilities><version>  
1.3.0 XML source: 
<WMS_Capabilities><version>  
UPDATE_SEQUENCE
1.1.1 XML source: 
<WMT_MS_Capabilities><updatesequence>  
1.3.0 XML source: 
<WMS_Capabilities><updatesequence>  
NAME
1.1.1, 1.3.0 XML source: <layer><name>  
TITLE
1.1.1, 1.3.0 XML source: 
<layer><title>  
ABSTRACT
1.1.1, 1.3.0 XML source: 
<layer><abstract>  
NUM_MAP_FORMAT
Provides the number of map formats as a convenience. This value is generated by IDL.
MAP_FORMAT
Array of strings (0 to many).
1.1.1, 1.3.0 XML source: 
<capability><request><getmap><format>  
NUM_FEATURE_FORMAT
Provides the number of feature formats as a convenience. This value is generated by IDL.
FEATURE_FORMAT
Array of strings (0 to many).
1.1.1, 1.3.0 XML source: 
<capability><request><getfeatureinfo>
<format>  
NUM_KEYWORD
Provides the number of keywords as a convenience. This value is generated by IDL.
KEYWORD
Array of strings (0 to many).
1.1.1, 1.3.0 XML source: 
<layer><keywordlist><keyword>  
NUM_SRS
Provides the number of SRS elements as a convenience. This value is generated by IDL.
Valid in version 1.1.1 only (version 1.3.0 always returns 0).
SRS
Array of strings (0 to many).
1.1.1 XML source: <layer><srs>  
NUM_CRS
Provides the number of CRS elements as a convenience. This value is generated by IDL.
Valid in version 1.3.0 only (version 1.1.1 always returns 0).
CRS
Array of strings (0 to many).
1.3.0 XML source: <layer><crs>  
LAT_LON_BBOX
Returns a structure. See Lat_Lon_Bbox Structure for details.
1.1.1 XML source: 
<layer><latlonboundingbox>  
Valid in version 1.1.1 only.
EX_GEOBOX
Returns a structure. See Ex_GeoBox Structure for details.
1.3.0 XML source: 
<layer><ex_geographicboundingbox>  
Valid in version 1.3.0 only.
NUM_BOUNDING_BOX
Provides the number of BOUNDING_BOX elements as a convenience. This value is generated by IDL.
BOUNDING_BOX
Returns an array of structures (0 to many). See Bounding_Box Structure for details.
1.1.1, 1.3.0 XML source: 
<layer><bounding_box>  
NUM_EXTENT
Provides the number of EXTENT elements as a convenience. This value is generated by IDL.
Valid in version 1.1.1 only (version 1.3.0 always returns 0).
EXTENT
Returns an array of structures (0 to many). See Extent Structure for details.
1.1.1 XML source: <layer><extent>  
NUM_DIMENSION
Provides the number of DIMENSION elements as a convenience. This value is generated by IDL.
DIMENSION
Returns an array of structures (0 to many). See Dimension Structure for details.
1.1.1, 1.3.0 XML source: 
<layer><dimension>  
ATTRIBUTION
Structure. See Attribution Structure for details.
1.1.1, 1.3.0 XML source: 
<layer><attribution>  
NUM_AUTHORITY
Provides the number of AUTHORITY elements as a convenience. This value is generated by IDL.
AUTHORITY
Returns an array of structures (0 to many). See Authority Structure for details.
1.1.1, 1.3.0 XML source: 
<layer><authority>  
NUM_IDENTIFIER
Provides the number of IDENTIFIER elements as a convenience. This value is generated by IDL.
IDENTIFIER
Returns an array of structures (0 to many). See Identifier Structure for details.
1.1.1, 1.3.0 XML source: 
<layer><identifier>  
NUM_METADATA_URL
Provides the number of METADATA_URL elements as a convenience. This value is generated by IDL.
METADATA_URL
Returns an array of structures (0 to many). See Metadata_URL Structure for details.
1.1.1, 1.3.0 XML source: 
<layer><metadataurl>  
NUM_DATA_URL
Provides the number of DATA_URL elements as a convenience. This value is generated by IDL.
DATA_URL
Returns an array of structures (0 to many). See Data_URL Structure for details.
1.1.1, 1.3.0 XML source: 
<layer><dataurl>  
NUM_FEATURE_URL
Provides the number of FEATURE_URL elements as a convenience. This value is generated by IDL.
FEATURE_URL
Returns an array of structures (0 to many). See Feature_URL Structure for details.
1.1.1, 1.3.0 XML source: 
<layer><featurelisturl>  
NUM_STYLE
Provides the number of STYLE elements as a convenience. This value is generated by IDL.
STYLE
Returns an array of structures (0 to many). See Style Structure for details.
1.1.1, 1.3.0 XML source: 
<layer><style>  
MIN_SCALE
1.1.1 XML source: 
<layer><scalehint><min>  
1.3.0 XML source: 
<layer><minscaledenominator>  
MAX_SCALE
1.1.1 XML source: 
<layer><scalehint><max>  
1.3.0 XML source: 
<layer><maxscaledenominator>  
QUERYABLE
1.1.1, 1.3.0 XML source: 
<layer><queryable>  
CASCADED
1.1.1, 1.3.0 XML source: 
<layer><cascaded>  
OPAQUE
1.1.1, 1.3.0 XML source: 
<layer><opaque>  
NO_SUBSETS
1.1.1, 1.3.0 XML source: 
<layer><nosubsets>  
FIXED_WIDTH
1.1.1, 1.3.0 XML source: 
<layer><fixedwidth>  
FIXED_HEIGHT
1.1.1, 1.3.0 XML source: 
<layer><fixedheight>  

Lat_Lon_Bbox Structure

This child structure is accessed through the LAT_LON_BBOX field of the parent layer structure. All elements are strings unless otherwise noted.

Table 9-22: Lat_Lon_Bbox Structure Fields 

Table 9-22: Lat_Lon_Bbox Structure Fields 
Field
Description
MINX
1.1.1 XML source: 
<layer><latlonboundingbox><minx>  
Valid only in version 1.1.1.
MINY
1.1.1 XML source: 
<layer><latlonboundingbox><miny>  
Valid only in version 1.1.1.
MAXX
1.1.1 XML source: 
<layer><latlonboundingbox><maxx>  
Valid only in version 1.1.1.
MAXY
1.1.1 XML source: 
<layer><latlonboundingbox><maxy>  
Valid only in version 1.1.1.

Ex_GeoBox Structure

This child structure is accessed through the EX_GEOBOX field of the parent layer structure. All elements are strings unless otherwise noted.

Table 9-23: Ex_GeoBox Structure Fields 

Table 9-23: Ex_GeoBox Structure Fields 
Field
Description
WEST
1.3.0 XML source: 
<layer><ex_geographicboundingbox><westboundlongitude>  
Valid only in version 1.3.0.
EAST
1.3.0 XML source: 
<layer><ex_geographicboundingbox><eastboundlongitude>  
Valid only in version 1.3.0.
SOUTH
1.3.0 XML source: 
<layer><ex_geographicboundingbox><southboundlatitude>  
Valid only in version 1.3.0.
NORTH
1.3.0 XML source: 
<layer><ex_geographicboundingbox><northboundlatitude>  
Valid only in version 1.3.0.

Bounding_Box Structure

This child structure is accessed through the BOUNDING_BOX field of the parent layer structure. To determine the number of Bounding_Box structures, access the NUM_BOUNDING_BOX field value. The number of structures can be 0 to many. All elements are strings unless otherwise noted.

Table 9-24: Bounding_Box Structure Fields

Table 9-24: Bounding_Box Structure Fields
Field
Description
SRS
1.1.1 XML source: <layer><boundingbox><srs>  
Valid only in version 1.1.1.
CRS
1.3.0 XML source: <layer><boundingbox><crs>  
Valid only in version 1.3.0.
MINX
1.1.1, 1.3.0 XML source: 
<layer><boundingbox><minx>  
MINY
1.1.1, 1.3.0 XML source: <layer><boundingbox><miny>
MAXX
1.1.1, 1.3.0 XML source: <layer><boundingbox><maxx>
MAXY
1.1.1, 1.3.0 XML source: <layer><boundingbox><maxy>
RESX
1.1.1, 1.3.0 XML source: <layer><boundingbox><resx>
RESY
1.1.1, 1.3.0 XML source: <layer><boundingbox><resy>

Extent Structure

This child structure is accessed through the EXTENT field of the parent layer structure. To determine the number of Extent structures, access the NUM_EXTENT field value. The number of structures can be 0 to many. All elements are strings unless otherwise noted.

Table 9-25: Extent Structure Fields 

Table 9-25: Extent Structure Fields 
Field
Description
NAME
1.1.1 XML source: <layer><extent><name>  
Valid only in version 1.1.1.
DEFAULT
1.1.1 XML source: <layer><extent><default>  
Valid only in version 1.1.1.
NEAREST_VALUE
1.1.1 XML source: <layer><extent><nearestvalue>  
Valid only in version 1.1.1.
EXTENT
1.1.1 XML source: <layer><extent>  
Valid only in version 1.1.1.

Dimension Structure

This child structure is accessed through the DIMENSION field of the parent layer structure. To determine the number of Dimension structures, access the NUM_DIMENSION field value. The number of structures can be 0 to many. All elements are strings unless otherwise noted.

Table 9-26: Dimension Structure Fields 

Table 9-26: Dimension Structure Fields 
Field
Description
NAME
1.1.1, 1.3.0 XML source: 
<layer><dimension><name>  
UNITS
1.1.1, 1.3.0 XML source: 
<layer><dimension><units>  
UNIT_SYMBOL
1.1.1, 1.3.0 XML source: 
<layer><dimension><unitsymbol>  
DEFAULT
1.3.0 XML source: <layer><dimension><default>  
Valid only in version 1.3.0.
MULTIPLE_VALUES
1.3.0 XML source: 
<layer><dimension><multiplevalues>  
Valid only in version 1.3.0.
NEAREST_VALUE
1.3.0 XML source: 
<layer><dimension><nearestvalue>  
Valid only in version 1.3.0.
CURRENT
1.3.0 XML source: <layer><dimension><current>  
Valid only in version 1.3.0.  
DIMENSION
1.1.1, 1.3.0 XML source: <layer><dimension>  

Attribution Structure

This child structure is accessed through the ATTRIBUTION field of the parent layer structure. All elements are strings unless otherwise noted.

Table 9-27: Attribution Structure Fields 

Table 9-27: Attribution Structure Fields 
Field
Description
TITLE
1.1.1, 1.3.0 XML source: 
<layer><attribution><title>  
ONLINE
1.1.1, 1.3.0 XML source: 
<layer><attribution><onlineresource>  
LOGO_FORMAT
1.1.1, 1.3.0 XML source: 
<layer><attribution><logourl><format>  
LOGO_ONLINE
1.1.1, 1.3.0 XML source: 
<layer><attribution><logourl><onlineresource>  
LOGO_WIDTH
1.1.1, 1.3.0 XML source: 
<layer><attribution><logourl><width>  
LOGO_HEIGHT
1.1.1, 1.3.0 XML source: 
<layer><attribution><logourl><height>  

Authority Structure

This child structure is accessed through the AUTHORITY field of the parent layer structure. To determine the number of Authority structures, access the NUM_AUTHORITY field value. The number of structures can be 0 to many. All elements are strings unless otherwise noted.

Table 9-28: Authority Structure Fields 

Table 9-28: Authority Structure Fields 
Field
Description
NAME
1.1.1, 1.3.0 XML source: 
<layer><authorityurl><name>  
ONLINE
1.1.1, 1.3.0 XML source: 
<layer><authorityurl><onlineresource>  

Identifier Structure

This child structure is accessed through the IDENTIFIER field of the parent layer structure. To determine the number of Identifier structures, access the NUM_IDENTIFIER field value. The number of structures can be 0 to many. All elements are strings unless otherwise noted.

Table 9-29: Identifier Structure Fields 

Table 9-29: Identifier Structure Fields 
Field
Description
ID
1.1.1, 1.3.0 XML source: 
<layer><identifier>  
AUTHORITY
1.1.1, 1.3.0 XML source: 
<layer><identifier><authority>  

Metadata_URL Structure

This child structure is accessed through the METADATA_URL field of the parent layer structure. To determine the number of Metadata_URL structures, access the NUM_METADATA_URL field value. The number of structures can be 0 to many. All elements are strings unless otherwise noted.

Table 9-30: Metadata_URL Structure Fields 

Table 9-30: Metadata_URL Structure Fields 
Field
Description
TYPE
1.1.1, 1.3.0 XML source: 
<layer><metadataurl><type>  
FORMAT
1.1.1, 1.3.0 XML source: 
<layer><metadataurl><format>  
ONLINE
1.1.1, 1.3.0 XML source: 
<layer><metadataurl><onlineresource>  

Data_URL Structure

This child structure is accessed through the DATA_URL field of the parent layer structure. To determine the number of Data_URL structures, access the NUM_DATA_URL field value. The number of structures can be 0 to many. All elements are strings unless otherwise noted.

Table 9-31: Data_URL Structure Fields 

Table 9-31: Data_URL Structure Fields 
Field
Description
FORMAT
1.1.1, 1.3.0 XML source: 
<layer><dataurl><format>  
ONLINE
1.1.1, 1.3.0 XML source: 
<layer><dataurl><onlineresource>  

Feature_URL Structure

This child structure is accessed through the FEATURE_URL field of the parent layer structure. To determine the number of Feature_URL structures, access the NUM_FEATURE_URL field value. The number of structures can be 0 to many. All elements are strings unless otherwise noted.

Table 9-32: Feature_URL Structure Fields 

Table 9-32: Feature_URL Structure Fields 
Field
Description
FORMAT
1.1.1, 1.3.0 XML source: 
<layer><featurelisturl><format>  
ONLINE
1.1.1, 1.3.0 XML source: 
<layer><featurelisturl><onlineresource>  

Style Structure

This child structure is accessed through the STYLE field of the parent layer structure. To determine the number of Style structures, access the NUM_STYLE field value. The number of structures can be 0 to many. All elements are strings unless otherwise noted.

Table 9-33: Style Structure Fields 

Table 9-33: Style Structure Fields 
Field
Description
NAME
1.1.1, 1.3.0 XML source: 
<layer><style><name>  
TITLE
1.1.1, 1.3.0 XML source: 
<layer><style><title>  
ABSTRACT
1.1.1, 1.3.0 XML source: 
<layer><style><title>  
LEGEND_FORMAT
1.1.1, 1.3.0 XML source: 
<layer><style><legendurl><format>  
LEGEND_ONLINE
1.1.1, 1.3.0 XML source: 
<layer><style><legendurl><onlineresource>  
LEGEND_WIDTH
1.1.1, 1.3.0 XML source: 
<layer><style><legendurl><width>  
LEGEND_HEIGHT
1.1.1, 1.3.0 XML source: 
<layer><style><legendurl><height>  
SHEET_FORMAT
1.1.1, 1.3.0 XML source: 
<layer><style><stylesheeturl><format>  
SHEET_ONLINE
1.1.1, 1.3.0 XML source: 
<layer><style><stylesheeturl>
<onlineresource>  
STYLE_FORMAT
1.1.1, 1.3.0 XML source: 
<layer><style><styleurl><format>  
STYLE_ONLINE
1.1.1, 1.3.0 XML source: 
<layer><style><styleurl><onlineresource>  

Arguments

None

Keywords

COUNT

Set this keyword to a variable that will contain the number of layer structures returned in this method's structure array. This value can be zero.

NUMBER

Set this keyword to the number of layers to return. If this keyword is not set, all layers will be returned minus the number of those skipped up to the INDEX keyword, if it is set. If this value is zero, zero layers will be returned. If the value is greater than the number of available layers, then this value is ignored and the number of available layers (COUNT) is returned.


Note
When populating a user interface, it is useful to set this keyword equal to the number of rows in the table.

INDEX

Set this keyword to the zero-based index of the first layer to return, skipping over all preceding layers. If this keyword is not set, all layers will be returned. You can use this property to enable navigation through a list of layers displayed in a user interface. For example, suppose there are 10 rows in a table. On the first call to GetLayers, set this value to 0 and NUMBER to 10. To display the next set of values, you would set this keyword to 10 (skip the first 10 values and display the next ten).

Examples

The following code parses the URL of WMS server, queries its capabilities (using GetCapabilities) and then extracts information from the returned XML file using GetLayers and GetServiceSection. Information is printed to the IDL Output Log.


Note
You may need to replace the URL in the following example as there is no guarantee that the given OCG server will be available when you attempt to establish the connection.

FUNCTION ogcwms_callback,  StatusInfo, CallbackData  
  
PRINT, StatusInfo  
  
; Indicate all is well.  
vCancelFlag = 1  
RETURN, vCancelFlag  
  
END  
  
PRO ogc_wms_getlayers_doc  
  
; Use the GetLayers method to access data returned in  
; the XML file by the GetCapabilities method.  
  
; This example queries an OGC server at the following URL. Change  
; the value of this variable to access a server of your choice.  
url="http://xtra.interactive-instruments.de/cgi-bin/wms?"  
  
; Catch error.  
CATCH, errorStatus  
IF (errorStatus NE 0) THEN BEGIN  
   CATCH,/CANCEL  
   PRINT, !ERROR_STATE.MSG  
   RETURN  
ENDIF  
  
; Create an IDLnetOGCWMS object and parse a known, working URL   
; to set mandatory properties. Use /VERBOSE to show additional   
; information.  
oWms = OBJ_NEW("IDLnetOGCWMS", $  
   CALLBACK_FUNCTION="ogcwms_callback", /VERBOSE)  
oWms->ParseUrl, url  
  
; Return and parse a description of all data holdings on  
; the WMS server.  
count = oWMS->GetCapabilities()  
  
; Make sure the server returned some layers.  
If (count NE 0) THEN BEGIN  
  
   ; Use the GetLayers method to translate the  
   ; parsed XML data into an array of IDL structures. The NAME  
   ; field of this structure is used to identify what layer   
   ; to request data for from the server.  
   layerStruct = oWMS->GetLayers $                            
      (COUNT=layercount, NUMBER=5, INDEX = 1)  
   PRINT, "Returning structures for ", + layercount, + " layers"  
  
   ; Access elements of the GetLayers structure.  
   FOR x=0, layerCount-1 DO BEGIN  
      PRINT, 'Layer = ', strtrim(x,2)  
      PRINT, '  parent          = ', layerStruct[x].parent  
      PRINT, '  level           = ', layerStruct[x].level  
      PRINT, '  name            = ', layerStruct[x].name  
      PRINT, '  title           = ', layerStruct[x].title  
      PRINT, '  version         = ', layerStruct[x].version  
      PRINT, '  authority_url   = ', layerStruct[x].authority  
      PRINT, '  num styles      =  ', layerStruct[x].num_style  
      FOR j=0, layerStruct[x].num_style-1 do begin  
        PRINT, '  style name   = ' , layerStruct[x].style[j].name  
        PRINT, '  style title  = ' , layerStruct[x].style[j].title  
      ENDFOR  
   ENDFOR  
  
   ; Use the GetServiceSection method to get the Service section  
   ; data from the XML file containing the layer info.  
   serviceStruct = oWMS->GetServiceSection()  
  
   PRINT, 'Service Section'  
   PRINT, '  name              = ', serviceStruct.name  
   PRINT, '  title             = ', serviceStruct.title  
   PRINT, '  abstract          = ', serviceStruct.abstract  
   HELP, serviceStruct.keyword  
   PRINT, '  keywords          = ', serviceStruct.keyword  
   PRINT, '  accessConstraints = ', serviceStruct.access  
ENDIF ELSE BEGIN  
   void = DIALOG_MESSAGE("No information available " $  
      + "from WMS Server", /ERROR)  
   RETURN  
ENDELSE  
  
; Cleanup.  
OBJ_DESTROY, oWms  
  
END  

 


Tip
Also see Sample WMS Browser.

Version History

6.4
Introduced

See Also

IDLnetOGCWMS::GetCapabilities, IDLnetOGCWMS::GetServiceSection

  IDL Online Help (March 06, 2007)