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:
- A large number of layers would require significant amounts of memory to return all of them at a single time
- A user interface needs to display a subset of the available items
Note
Use IDLnetOGCWMS::GetServiceSection to return information related to the service section of the layer information.
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.
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.
|
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 |
|
| UPDATE_SEQUENCE |
|
| NAME |
|
| TITLE |
|
| 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). |
| 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). |
| NUM_KEYWORD |
Provides the number of keywords as a convenience. This value is generated by IDL. |
| KEYWORD |
Array of strings (0 to many). |
| 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). |
| 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). |
| LAT_LON_BBOX |
Returns a structure. See Lat_Lon_Bbox Structure for details. Valid in version 1.1.1 only. |
| EX_GEOBOX |
Returns a structure. See Ex_GeoBox Structure for details. 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. |
| 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. |
| 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. |
| ATTRIBUTION |
Structure. See Attribution Structure for details. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| MIN_SCALE |
|
| MAX_SCALE |
|
| QUERYABLE |
|
| CASCADED |
|
| OPAQUE |
|
| NO_SUBSETS |
|
| FIXED_WIDTH |
|
| FIXED_HEIGHT |
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.
|
Field
|
Description
|
|---|---|
| MINX |
Valid only in version 1.1.1. |
| MINY |
Valid only in version 1.1.1. |
| MAXX |
Valid only in version 1.1.1. |
| 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.
|
Field
|
Description
|
|---|---|
| WEST |
Valid only in version 1.3.0. |
| EAST |
Valid only in version 1.3.0. |
| SOUTH |
Valid only in version 1.3.0. |
| NORTH |
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.
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.
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.
Attribution Structure
This child structure is accessed through the ATTRIBUTION field of the parent layer structure. All elements are strings unless otherwise noted.
|
Field
|
Description
|
|---|---|
| TITLE |
|
| ONLINE |
|
| LOGO_FORMAT |
|
| LOGO_ONLINE |
|
| LOGO_WIDTH |
|
| LOGO_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.
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.
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.
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.
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.
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.
|
Field
|
Description
|
|---|---|
| NAME |
|
| TITLE |
|
| ABSTRACT |
|
| LEGEND_FORMAT |
|
| LEGEND_ONLINE |
|
| LEGEND_WIDTH |
|
| LEGEND_HEIGHT |
|
| SHEET_FORMAT |
|
| SHEET_ONLINE |
|
| STYLE_FORMAT |
|
| STYLE_ONLINE |
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://data.ittvis.com:80/cgi-bin/mapserv.exe?" + $ "map=/OGC_Data/WMS/wms_demo.map&service=WMS" ; Catch error. CATCH, errorStatus IF (errorStatus NE 0) THEN BEGIN CATCH,/CANCEL PRINT, !ERROR_STATE.MSG IF OBJ_VALID(oWms) THEN OBJ_DESTROY, oWms 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 ENDTip
Also see Sample WMS Browser.
Version History
See Also
IDLnetOGCWMS::GetCapabilities, IDLnetOGCWMS::GetServiceSection