The WMSLayer object defines the properties required to build a layer using WMS services.

Attribute list

Attribute Type Description

layerType

string

[Required]

The layer type. Fixed constant: "WMS".

name

string

[Required]

The layer name.

visible

boolean

[Required]

The visibility of the layer.

url

string

[Required]

The address (uri) of the map service.

layers

array <string>

[Required]

The list of layers in the WMS service.

The first layer in the list displays at the bottom of the map, the next layer is placed on top of the previous one, and so on.

Each value of the layers array corresponds to the value of the <Layer><Name> of the service meta-data.

opacity

number

[Optional]

The opacity of the layer. The maximum value is 1 and the minimum value is 0.

visibleScale

VisibleScale

[Optional]

Stores the visible scale range of the current layer.

Example

  1. Use WMS map service to build a layer that conforms to the WebMap specification.

 {

   "layers": [

        {

            "layerType": "WMS",

            "name": "GangAo_ln@China_L5_L6",

            "visible": true,

            "url": "http://192.168.17.199:8090/iserver/services/map-china400/wms130/China",

            "layers": [

                "0.0"

            ],

           "visibleScale": {

                "maxScale": "1:2256.999",

                "minScale": "1:591658710.909"

            },

            "opacity": 0.85

        }

    ],

}

  1. Use WMS map service to build a basemap that conforms to the WebMap specification.

 {  

  "baseLayer": {

        "layerType": "WMS",

        "name": "China",

        "url": "http://192.168.17.199:8090/iserver/services/map-china400/wms111/China",

        "layers": [

            "0"

        ]

    },

 }