Unique values map is to classify elements with the same thematic value into one category, and set a rendering style for each category, and each category is a thematic map sub-item. The UniqueLayer object defines the attributes required to construct a unique values map.

Attribute list

Attribute Type Description

layerType

string

[Required]

The layer type. Fixed constant: "UNIQUE".

name

string

[Required]

The layer name.

visible

boolean

[Required]

The visibility of the layer.

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.

dataSource

DataSource

[Required]

The datasource of the UniqueLayer is one of the following five datasources:

 PortalDataSource, SampleData, RestData, UserData, RestMap.

projection

string

[Required]

The projected coordinate system of the map. Optional value: EPSG or WKT universal coordinate system description standard.

featureType

string

[Required]

The feature type. Optional constants: "POINT", "LINE", "POLYGON".

xyField

object<srting>

[Required]

It consists of two sub-attributes "xField" and "yField", which respectively define the name of the field to which the X and Y coordinates of the point feature belong.

style

object

[Required]

The feature style, determined by the featureType attribute. If the featureType is "POINT", the point feature style must meet PointStyle ; if the featureType is "LINE", the line feature style must meet LineStyle; if the featureType is "POLYGON", the polygon feature style must meet PolygonStyle .

themeSetting

UniqueThemeSetting

[Required]

Theme settings.

labelStyle

LabelStyle

[Optional]

Label style.

legendSetting

LegendSetting

[Optional]

Legend settings.

searchSetting

SearchSetting

[Optional]

Search settings.

enableFields

array<string>

[Required]

The fields displayed in attribute table

captions

object

[Optional]

The key is the field name, and the value is the user-defined string type field display name, for example: {"ADDRESS":"ADDRESS display name"}.

popupInfo

WithPopupInfo

[Optional]

Settings for the attribute pop-up window.

autoUpdateTime

number

[Optional]

The time for the layer data to be automatically refreshed, in milliseconds.

Example

Construct a UniqueLayer that conforms to the WebMap specification.

{

    "layers": [

        {

            "layerType": "UNIQUE",

            "name": "Partial provincial capitals",

            "visible": true,

            "featureType": "POLYGON",

            "projection": "EPSG:4326",

            "enableFields": [

                "Province",

                "Capitals"

            ],

            "style": {

                "lineDash": "solid",

                "strokeWidth": 1,

                "strokeColor": "#ffffff",

                "strokeOpacity": 1,

                "fillOpacity": 0.9,

                "fillColor": "#99D594",

                "type": "POLYGON"

            },

            "themeSetting": {

                "themeField": "Province",

                "colors": [

                    "#D53E4F",

                    "#FC8D59",

                    "#FEE08B",

                    "#FFFFBF",

                    "#E6F598",

                    "#99D594",

                    "#3288BD"

                ],

                "customSettings": {

                    "Xinjiang": {

                        "lineDash": "solid",

                        "strokeWidth": 1,

                        "strokeColor": "#ffffff",

                        "strokeOpacity": 1,

                        "fillOpacity": 0.9,

                        "fillColor": "#c78cff",

                        "type": "POLYGON"

                    },

                    "Tibet": {

                        "lineDash": "solid",

                        "strokeWidth": 1,

                        "strokeColor": "#ffffff",

                        "strokeOpacity": 1,

                        "fillOpacity": 0.9,

                        "fillColor": "#3288BD",

                        "type": "POLYGON"

                    },

                    "Qinghai": {

                        "lineDash": "solid",

                        "strokeWidth": 1,

                        "strokeColor": "#ffffff",

                        "strokeOpacity": 1,

                        "fillOpacity": 0.9,

                        "fillColor": "#FC8D59",

                        "type": "POLYGON"

                    },

                    "Gansu": {

                        "lineDash": "solid",

                        "strokeWidth": 1,

                        "strokeColor": "#ffffff",

                        "strokeOpacity": 1,

                        "fillOpacity": 0.9,

                        "fillColor": "#99D594",

                        "type": "POLYGON"

                    }

                }

            },

            "dataSource": {

                "type": "PORTAL_DATA",

                "serverId": "2001908278",

                "accessType": "DIRECT",

                "administrativeInfo": {

                    "divisionType": "Province",

                    "divisionField": "Province"

                }

            }

        }

    ],

}