Provides a layer list UI control for a map.
Demo: http://wsdot-gis.github.io/arcgis-js-layer-list/demo
webmap
parameterYou can try the demo a webmap from ArcGIS online by adding the webmap
query string parameter.
http://wsdot-gis.github.io/arcgis-js-layer-list/demo?webmap=927b5daaa7f4434db4b312364489544d
.layer-list
This class is applied to the layer list's root <ul>
element.
.layer-label
A layer's label will have this class.
.control-container
This is for styling the per-layer controls' container, which contains opacity and sublayer controls.
.sublayer-list
List of a layer's sublayers will have this class.
opacity-slider
The <input type='range'>
element that controls a layer's opacity will have this class.
.badge
The badge
classes use the :before
pseudo-class.
.badge-supports-dynamic-layers
A badge that is used to indicate a layer supports the dynamicLayers
capability introduced at ArcGIS Server 10.3.
layer-type-arcgis-feature-layer
layer-type-arcgis-map-service-layer
layer-type-arcgis-tiled-map-service-layer
.toggle-closed
Clicking a layer's label will add or remove this class from the corresponding layer's list item element. This is used to hide layer's controls.
.toggle-closed .control-container {
display: none;
}
Object
Represents an operation layer in a web map.
HTMLSpanElement
string
HTMLSpanElement
HTMLSpanElement
Creates an HTML span with classes applied.
Kind: static method of badgeUtils
Returns: HTMLSpanElement
- Returns the HTML span element that can be styled into a badge.
Param | Type | Description |
---|---|---|
...classNames | string |
One or more class names to be added to the span. |
string
Creates a CSS class name based on a operationalLayers elements' layerType value.
Kind: static method of badgeUtils
Returns: string
- A string that can be used as a CSS class name.
Param | Type | Description |
---|---|---|
layerType | string |
The layer type's name |
HTMLSpanElement
Creates a span element with a layer type class and "badge" class.
Kind: static method of badgeUtils
Returns: HTMLSpanElement
- An HTML span element that can be transformed into a badge via CSS.
Param | Type | Description |
---|---|---|
layerType | string |
Layer type name |
Param | Type | Description |
---|---|---|
operationalLayers | Array.<external:OperationLayer> |
An array of operational layers. |
domNode | external:HTMLUListElement | external:HTMLOListElement |
The root DOM node: either an UL or OL. |
Call this function to update the out-of-scale classes on layers.
Kind: instance method of LayerList
Param | Type | Description |
---|---|---|
scale | number |
The new scale |
Example
// map is an esri/Map object.
map.on("zoom-end", function () {
// Update layer list items to show if they are not visible due to zoom scale.
layerList.setScale(map.getScale());
});
external:HTMLUListElement
| external:HTMLOListElement
Kind: inner property of LayerList
external:HTMLDialogElement
Kind: inner property of LayerList
HTMLDialogElement
HTMLDialogElement
HTMLDialogElement
Creates the layer options dialog. The layer list will use a single dialog for the options of all layers. The controls and contents will be updated when called for a layer.
Kind: static method of LayerOptionsDialog
Returns: HTMLDialogElement
- Returns a dialog that the user can use to set layer options.
HTMLDialogElement
Shows the layer options dialog with options for the specified layer.
Kind: static method of LayerOptionsDialog
Returns: HTMLDialogElement
- The layer options dialog for the input operational layer.
Param | Type | Description |
---|---|---|
opLayer | OperationalLayer |
An operational layer |
Boolean
Array.<number>
Array.<string>
Boolean
Determines if an array contains a given value.
Kind: inner method of miscUtils
Returns: Boolean
- Returns true if the array contains the given value, false otherwise.
Param | Type | Description |
---|---|---|
array | Array |
An array to be searched. |
value | * |
The value to search for in the array. |
Array.<number>
Parses a string containing comma-separated integer values into an array of integers.
Kind: inner method of miscUtils
Returns: Array.<number>
- Returns the integers listed in the input string as an array of numbers.
Param | Type | Description |
---|---|---|
s | string |
A string containing a comma-separated list of integers. |
Array.<string>
Splits a camel-case or Pascal-case variable name into individual words.
Kind: inner method of miscUtils
Returns: Array.<string>
- The input string, split into different parts.
Param | Type | Default | Description |
---|---|---|---|
s | string |
A camel-case or Pascal-case string. | |
[re] | RegExp |
/([A-Za-z]?)([a-z]+)/g |
Regular expression used for detecting the start of a new word. |
HTMLUListElement
HTMLLIElement
A list of a map service's sublayers.
Param | Type | Description |
---|---|---|
layer | esri/layers/Layer |
A layer. |
HTMLUListElement
Kind: inner property of SublayerList
HTMLLIElement
Creates a sublayer list item representing a layer info.
Kind: inner method of SublayerList
Returns: HTMLLIElement
- A sublayer list item representing the input layer info object.
Param | Type | Description |
---|---|---|
layerInfo | esri/layers/LayerInfo |
A LayerInfo object. |
Promise
Gets legend info for a map service.
Kind: inner method of LegendHelper
Param | Type | Description |
---|---|---|
mapServiceUrl | string | esri/layers/layer |
Either the URL of a map service or a Layer class from the ArcGIS API for JavaScript. |
[dynamicLayers] | Array.<Object> |
Dynamic layer definitions. |
string
string
string
string
number
number
Array.<number>
string
HTMLTableRowElement
Represents an item in a layer's legend.
Param | Type | Description |
---|---|---|
json | Object |
Initializes member values. |
string
Kind: instance property of LegendItem
string
Kind: instance property of LegendItem
string
Kind: instance property of LegendItem
string
Kind: instance property of LegendItem
number
Kind: instance property of LegendItem
number
Kind: instance property of LegendItem
Array.<number>
Kind: instance property of LegendItem
string
Returns a data URL for the legend item's image.
Kind: instance method of LegendItem
Returns: string
- Data URL of an image.
HTMLTableRowElement
Creates a table row representation of a legend item.
Kind: instance method of LegendItem
number
string
string
number
number
Array.<LegendItem>
HTMLTableElement
Represents a layer of a map service.
Param | Type | Description |
---|---|---|
json | Object |
Corresponds to members to initialize their values. |
number
Kind: instance property of LegendLayer
string
Kind: instance property of LegendLayer
string
Kind: instance property of LegendLayer
number
Kind: instance property of LegendLayer
number
Kind: instance property of LegendLayer
Array.<LegendItem>
Kind: instance property of LegendLayer
HTMLTableElement
Creates an HTML table for a legend layer.
Kind: instance method of LegendLayer
Array.<LegendLayer>
Array.<HTMLTableElement>
LegendResponse
The top level of a response for a Legend request.
Param | Type |
---|---|
json | Object |
json.layers | Array.<LegendLayer> |
Array.<LegendLayer>
Kind: instance property of LegendResponse
Array.<HTMLTableElement>
Creates an array of HTML tables with a layer's legend. Array ordinals correspond to layer IDs. Some elements may be undefined if there is no corresponding layer.
Kind: instance method of LegendResponse
LegendResponse
Parses legend response text into a LegendResponse object.
Kind: static method of LegendResponse
Param | Type | Description |
---|---|---|
jsonString | string |
Response from a map service legend request. |
Object
Represents an operation layer in a web map.
Kind: global external
See: ArcGIS REST API: operationalLayer
Properties
Name | Type | Description |
---|---|---|
id | string |
The ID that will be given to the layer when added to a map. |
layerType | string |
The type of layer. |
url | string |
|
visibility | Boolean |
|
opacity | Number |
|
title | string |
|
itemId | string |
ArcGIS Online item id |
minScale | Number |
|
maxScale | Number |