require(["esri/layers/ArcGISDynamicMapServiceLayer"], function(ArcGISDynamicMapServiceLayer) { /* code goes here */ });Description
(Added at v1.0)
Allows you to work with a dynamic map service resource exposed by the ArcGIS Server REST API. A dynamic map service generates images on the fly. For cached map services, see
ArcGISTiledMapServiceLayer.
If the first layer added to the map is an ArcGISDynamicMapServiceLayer, the map will take on the projection of this layer.
SamplesSearch for
samplesthat use this class.
Class hierarchyesri/layers/Layer |_esri/layers/DynamicMapServiceLayer |_esri/layers/ArcGISDynamicMapServiceLayerConstructors Properties attributionDataUrl
String
The URL, when available, where the layer's attribution data is stored. capabilities String
Capabilities of the map service, possible values are Map, Query and Data. className String
class attribute of the layer's node. copyright String
Copyright string as defined by the map service. credential Credential
Provides credential information for the layer such as userid and token if the layer represents a resource that is secured with token-based authentication. description String
Map description as defined by the map service. disableClientCaching Boolean
When true, images are always requested from the server and the browser's cache is ignored. dpi Number
The output dpi of the dynamic map service layer. dynamicLayerInfos DynamicLayerInfo[]
Array of DynamicLayerInfos used to change the layer ordering or redefine the map. fullExtent Extent
Full extent as defined by the map service. gdbVersion String
The geodatabase version. hasAttributionData Boolean
When true, the layer has attribution data. id String
ID assigned to the layer. imageFormat String
The output image type. imageTransparency Boolean
Whether or not background of dynamic image is transparent. infoTemplates Object
A dictionary from the layer id to the layerInfoTemplateOptions
object. initialExtent Extent
Initial extent as defined by the map service. layerDefinitions String[]
Sets the layer definitions used to filter the features of individual layers in the map service. layerDrawingOptions LayerDrawingOptions[]
Array of LayerDrawingOptions used to override the way layers are drawn. layerInfos LayerInfo[]
Returns the available layers in service and their default visibility. layerTimeOptions LayerTimeOptions[]
Returns the current layer time options if applicable. loadError Error
Set if the layer failed to load. loaded Boolean
When the layer is loaded, the value becomes "true", and layer properties can be accessed. maxImageHeight Number
The maximum image height, in pixels, that the map service will export. maxImageWidth Number
The maximum image width, in pixels, that the map service will export. maxRecordCount Number
The maximum number of results that can be returned from query, identify and find operations. maxScale Number
Maximum visible scale for the layer. minScale Number
Minimum visible scale for the layer. opacity Number
Opacity or transparency of layer. refreshInterval Number
Refresh interval of the layer in minutes. showAttribution Boolean
When true, the layer's attribution is displayed on the map. spatialReference SpatialReference
The spatial reference of the map service. supportsDynamicLayers Boolean
Indicates if the service supports dynamic layers. suspended Boolean
When true, the layer is suspended. timeInfo TimeInfo
Temporal information for the layer, such as time extent. units String
Default units of the layer as defined by the service. url String
URL to the ArcGIS Server REST resource that represents a map service. useMapImage Boolean
When true, the image is saved to the server, and a JSON formatted response is sent to the client with the URL location of the image. version Number
The version of ArcGIS Server where the map service is published. visible Boolean
Visibility of the layer. visibleAtMapScale Boolean
When true, the layer is visible at the current map scale. visibleLayers Number[]
Gets the visible layers of the exported map. Methods attr(name, value) Layer
Adds a new attribute or changes the value of an existing attribute on the layer's node. createDynamicLayerInfosFromLayerInfos() DynamicLayerInfo[]
Create an array of DynamicLayerInfos based on the current set of LayerInfo. exportMapImage(imageParameters?, callback?) None Exports a map using values as specified by ImageParameters. getAttributionData() Deferred
Asynchronously returns custom data for the layer when available. getImageUrl(extent, width, height, callback) String
Method to implement when extending DynamicMapServiceLayer. getMap() Map
Returns reference to the map control the layer is added to. getNode() HTMLElement
Returns the layer's DOM node. hide() None Sets the visibility of the layer to "false". isVisibleAtScale(scale) Boolean
Returns true if the layer is visible at the given scale. refresh() None Refreshes the map by making a new request to the server. resume() None Resumes layer drawing. setDPI(dpi, doNotRefresh?) None Sets the dpi of the exported map. setDefaultLayerDefinitions(doNotRefresh?) None Resets all layer definitions to those defined in the service. setDefaultVisibleLayers(doNotRefresh?) None Clears the visible layers as defined in setVisibleLayers, and resets to the default layers of the map service. setDisableClientCaching(disable) None Sets whether images are always requested from the server and the browser's cache is ignored. setDynamicLayerInfos(dynamicLayerInfos, doNotRefresh?) None Specify an array of DynamicLayerInfos used to change the layer ordering or to redefine the map. setGDBVersion(gdbVersion, doNotRefresh?) None Set the version for the ArcGIS DynamicMapServiceLayer. setImageFormat(imageFormat, doNotRefresh?) None Sets the image format of the exported map. setImageTransparency(transparent, doNotRefresh?) None Sets the background of a dynamic image to transparent. setInfoTemplates(infoTemplates) None Set the infoTemplates
property. setLayerDefinitions(layerDefinitions, doNotRefresh?) None Sets the layer definitions used to filter the features of individual layers in the map service. setLayerDrawingOptions(layerDrawingOptions, doNotRefresh?) None Specify an array of LayerDrawingOptions that override the way the layers are drawn. setLayerTimeOptions(options, doNotRefresh?) None Sets the time-related options for the layer. setMaxScale(scale) None Set the maximum scale for the layer. setMinScale(scale) None Set the minimum scale for the layer. setOpacity(opacity) None Sets the opacity of the layer. setRefreshInterval(interval) Layer
Changes the layer's refresh interval to the given value (in minutes). setScaleRange(minScale, maxScale) None Set the scale range for the layer. setUseMapTime(update) None Determine if the layer will update its content based on the map's current time extent. setVisibility(isVisible) None Sets the visibility of the layer. setVisibleLayers(ids, doNotRefresh?) None Sets the visible layers of the exported map. show() None Sets the visibility of the layer to "true". suspend() None Suspends layer drawing. Events
[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.
Events error{
error: <Error
>
}
Fires when there is a problem retrieving a layer. gdb-version-change Fired when the geodatabase version is switched. load
{
layer: <Layer
>
}
Fires after layer properties for the layer are successfully populated. map-image-export
{
mapImage: <MapImage
>
}
Fires when the map export is completed. opacity-change
{
opacity: <Number
>
}
Fires when the layer opacity has been changed, and returns an object with the opacity value. refresh-interval-change This event is fired when the layer's refreshInterval
is modified. resume Fires when a layer resumes drawing. scale-range-change Fires when a layer's minScale and/or maxScale is changed. scale-visibility-change Fires when a layer's scale visibility changes. suspend Fires when a layer suspends drawing. update Fires any time a layer has finished loading or updating itself. update-end
{
error: <Error
>
}
Fires when a layer has finished updating its content. update-start Fires when a layer begins to update its content. visibility-change
{
visible: <Boolean
>
}
Fires when the layer visibility has been changed, and returns an object with a Boolean visible property containing the new visibility value of the layer. visible-layers-change
{
visibleLayers: <Number[]
>
}
Fires when the visibleLayers
property is changed.
Constructor Details
Creates a new ArcGISDynamicMapServiceLayer object. A URL is a required parameter. This layer also takes some optional parameters. These optional parameters can be included in any order.
Parameters: <String
> url Required URL to the ArcGIS Server REST resource that represents a map service. An example is https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer. <Object
> options Optional Optional parameters. See options list. options
properties: <String
> className Optional Class attribute to set for the layer's node. <String
> gdbVersion Optional Specify the geodatabase version to display. (As of v2.7). Requires ArcGIS Server service 10.1 or greater <String
> id Optional Id to assign to the layer. If not assigned, esri.Map assigns value. <ImageParameters
> imageParameters Optional Represents the image parameter options. <Object
> infoTemplates Optional infoTemplates
object. See the infoTemplates
property for details. <Number
> opacity Optional Initial opacity or transparency of layer. Values range from 0.0 to 1.0, where 0.0 is 100% transparent and 1.0 has no transparency. The default value is 1.0. <Number
> refreshInterval Optional Refresh interval of the layer in minutes. Non-zero value sets up automatic layer refresh at the specified interval. <Object
> resourceInfo Optional Specify the metadata of the layer. <Boolean
> showAttribution Optional When true, the layer's attribution is displayed on the map. The default value is true. Added at v3.1
require([ "esri/layers/ArcGISDynamicMapServiceLayer", ... ], function(ArcGISDynamicMapServiceLayer, ... ) { var census = new ArcGISDynamicMapServiceLayer(layerUrl, { "showAttribution": false, "opacity": 0.5 }); ... });<
Boolean
> useMapImage Optional By default, images are exported in MIME format, and the image is streamed to the client. When useMapImage is set to true, the image is saved to the server, and a JSON formatted response is sent to the client with the URL location of the image. A second call is automatically made to the server to retrieve the image. This methodology is required for secure services that go through a proxy server. In this situation, a map image cannot be streamed. (As of v1.2) Deprecated at v2.0. Prior to v2.0 this option was used to configure the map to use the proxy all the time. This is not the optimal behavior so at v2.0 the switch to use the proxy will automatically happen if needed. <Boolean
> useMapTime Optional When true, the layer will update its content based on the map's time extent. The default values is true. <Boolean
> visible Optional Initial visibility of the layer. Default is true. Sample:
require([ "esri/layers/ArcGISDynamicMapServiceLayer", ... ], function(ArcGISDynamicMapServiceLayer, ... ) { var layer = new ArcGISDynamicMapServiceLayer( "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",{ "opacity": 0.75 } ); ... });
Property Details
The URL, when available, where the layer's attribution data is stored. (Added at v3.1)
Capabilities of the map service, possible values are Map, Query and Data. Only available if the map service is published using ArcGIS Server version 10 or greater. (Added at v2.1)
Sample:console.log(layer.capabilities);class
attribute of the layer's node.
(Added at v3.7)Copyright string as defined by the map service.
Provides credential information for the layer such as userid and token if the layer represents a resource that is secured with token-based authentication. This value is available after the layer has been loaded i.e. layer.loaded
is true. (Added at v2.5)
Map description as defined by the map service.
When true, images are always requested from the server and the browser's cache is ignored. This should be used when the data supporting the map service changes frequently. (Added at v1.2)
Known values: true | false
Default value: false
The output dpi of the dynamic map service layer.
Default value: 96
Array of DynamicLayerInfos used to change the layer ordering or redefine the map. (Added at v2.7)
Full extent as defined by the map service.
The geodatabase version. Only applicable if the layer's data source is registered as versioned in SDE. Only valid with ArcGIS Server services version 10.1 or greater. (Added at v2.7)
When true, the layer has attribution data. The default value is false. Use the
getAttributionDatamethod to retrieve this data as JSON.
(Added at v3.1)Known values: true | false
ID assigned to the layer. If not assigned, esri.Map assigns value. By default, the ID of the layer is "layer" followed by a number. The ID can be user defined only in the layer constructor.
Sample:require([ "esri/layers/ArcGISDynamicMapServiceLayer", ... ], function(ArcGISDynamicMapServiceLayer, ... ) { var population = new ArcGISDynamicMapServiceLayer("http://myserver/arcgis/rest/population/MapServer/Layers", {id:"population"}); ... });
population.id = "population";
function getMapLayers() { for (var j=0, jl=map.layerIds.length; j<jl; j++) { var currentLayer = map.getLayer(map.layerIds[j]); alert("id: " + currentLayer.id); } }
The output image type. As of ArcGIS Server 9.3.1, the list of supported image formats is included in the description of Map Services in Services Directory under "Supported Image Format Types". In addition, as of ArcGIS Server 9.3.1, optimized map services can produce true PNG32 images.
Known values: png | png8 | png24 | png32 | jpg | pdf | bmp | gif | svg
Default value: png8
Whether or not background of dynamic image is transparent.
Known values: true | false
Default value: true
A dictionary from the layer id to the layerInfoTemplateOptions
object. See the object specifications table below for properties of the layerInfoTemplateOptions
object. (Added at v3.10)
<layerInfoTemplateOptions
>
InfoTemplate
> infoTemplate Required The infoTemplate for the layer. <String
> layerUrl Required URL to the layer. <Object
> resourceInfo Required Metadata of the layer. Sample:
var infoTemplates = { 3: { infoTemplate: new InfoTemplate(), layerUrl: null } };
Initial extent as defined by the map service.
Sets the layer definitions used to filter the features of individual layers in the map service. Layer definitions with semicolons or colons are supported if using a map service published using ArcGIS Server 10.0. (Added at v1.2)
Array of LayerDrawingOptions used to override the way layers are drawn. (Added at v2.7)
Returns the available layers in service and their default visibility.
Returns the current layer time options if applicable. Use the setLayerTimeOptions method to modify the time options. (Added at v2.0)
Set if the layer failed to load. (Added at v3.9)
When the layer is loaded, the value becomes "true", and layer properties can be accessed. The
onLoadevent is also fired.
Known values: true | false
The maximum image height, in pixels, that the map service will export. Requires ArcGIS Server version 10.1 or greater. (Added at v2.6)
The maximum image width, in pixels, that the map service will export. Requires ArcGIS Server version 10.1 or greater. (Added at v2.6)
The maximum number of results that can be returned from query, identify and find operations. Requires ArcGIS Server version 10.1 or greater. (Added at v2.6)
Maximum visible scale for the layer. If the map is zoomed in beyond this scale, the layer will not be visible. A value of 0 means the layer does not have a maximum scale. The default value is 0. (Added at v3.1)
Default value: 0
Minimum visible scale for the layer. If the map is zoomed out beyond this scale, the layer will not be visible. A value of 0 means the layer does not have a visible scale. The default value is 0. (Added at v3.1)
Default value: 0
Opacity or transparency of layer. Values range from 0.0 to 1.0, where 0.0 is 100% transparent and 1.0 has no transparency.
Known values: 0.0 - 1.0
Default value: 1.0
Refresh interval of the layer in minutes. Non-zero value indicates automatic layer refresh at the specified interval. Value of 0 indicates auto refresh is not enabled. (Added at v3.7)
When true, the layer's attribution is displayed on the map. This attribution can be found as 'Copyright Text' at the REST endpoint. The default value is true. (Added at v3.1)
Known values: true | false
Indicates if the service supports dynamic layers. (Added at v3.11)
Known values: true | false
var layer = new ArcGISDynamicMapServiceLayer("https://www.example.com/arcgis/rest/services/Energy/Geology/MapServer"); layer.on("load", function(){ console.log(layer.supportsDynamicLayers); }); map.addLayer(layer)
When true, the layer is suspended. A layer is considered to be suspended when one of the following is true:
Layer.suspend
method.Known values: true | false
Temporal information for the layer, such as time extent. If this property is null or not specified, then the layer does not support time-related operations. (Added at v2.0)
Default units of the layer as defined by the service. If the layer is the base map, the map is in these units.
When true, the image is saved to the server, and a JSON formatted response is sent to the client with the URL location of the image. A second call is automatically made to the server to retrieve the image. This value is set in the constructor using useMapImage. Deprecated at v2.0. (Added at v1.2)
Known values: true | false
Default value: false
The version of ArcGIS Server where the map service is published. Examples are 9.3, 9.31, 10. (Added at v2.1)
Visibility of the layer.
Known values: true | false
Default value: true
When true, the layer is visible at the current map scale. (Added at v3.1)
Known values: true | false
Gets the visible layers of the exported map. (Added at v1.2)
Method Details
Adds a new attribute or changes the value of an existing attribute on the layer's node. Removes the attribute if the value is null
or undefined
. (Added at v3.7)
String
> name Required The name of the attribute. <String
> value Required The value of the attribute. Set this value as null
to remove the attribute.
Create an array of DynamicLayerInfos based on the current set of LayerInfo. (Added at v2.7)
Sample:var dynamicLayerInfos = usaLayer.createDynamicLayerInfosFromLayerInfos();Parameters: <
ImageParameters
> imageParameters Optional Input parameters assigned before exporting the map image. <Function
> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onMapImageExport event.
Asynchronously returns custom data for the layer when available. This attribution can be found as 'Copyright Text' at the REST endpoint. (Added at v3.1)
Parameters: <Extent
> extent Required Current extent of the map. <Number
> width Required Current width of the map in pixels. <Number
> height Required Current height of the map in pixels. <Function
> callback Required The function to call when the method has completed.
Returns reference to the map control the layer is added to. Returns null
or undefined
if it is not added to a map. (Added at v3.7)
Returns the layer's DOM node. (Added at v3.7)
Sets the visibility of the layer to "false". The layer is not removed, but it is hidden from view.
Returns true if the layer is visible at the given scale. (Added at v3.1)
Parameters: <Number
> scale Required The scale at which to check if the layer is visible.
Refreshes the map by making a new request to the server. In order to refresh the layer in this manner, setDisableClientCaching must be true. This ensures that map images are not cached on the client. (Added at v1.2)
Resumes layer drawing. (Added at v3.1)
Sets the dpi of the exported map. The default value is 96.
Parameters: <Number
> dpi Required DPI value. <Boolean
> doNotRefresh Optional Added at version 2.2 When true the layer will not refresh the map image. The default value is false.
Resets all layer definitions to those defined in the service. (Added at v1.1)
Parameters: <Boolean
> doNotRefresh Optional When true the layer will not refresh the map image. The default value is false. Added at version 2.2.
Clears the visible layers as defined in
setVisibleLayers, and resets to the default layers of the map service.
Parameters: <Boolean
> doNotRefresh Optional When true the layer will not refresh the map image. The default value is false. Added at version 2.2.
Sets whether images are always requested from the server and the browser's cache is ignored. This should be used when the data supporting the map service changes frequently. (Added at v1.2)
Parameters: <Boolean
> disable Required When true, client side caching is disabled. Sample:
require([ "esri/layers/ArcGISDynamicMapServiceLayer", ... ], function(ArcGISDynamicMapServiceLayer, ... ) { var layer = new ArcGISDynamicMapServiceLayer( "https://www.example.com/arcgis/rest/services/Petroleum/KSFields/MapServer"); layer.setDisableClientCaching(true); ... });
Specify an array of DynamicLayerInfos used to change the layer ordering or to redefine the map. (Added at v2.7)
Parameters: <DynamicLayerInfo[]
> dynamicLayerInfos Required An array of dynamic layer infos. <Boolean
> doNotRefresh Optional When true the layer will not refresh the map image. The default value is false. Sample:
require([ "esri/layers/DynamicLayerInfo", "esri/layers/QueryDataSource", "esri/layers/LayerDataSource", ... ], function(DynamicLayerInfo, QueryDataSource, LayerDataSource, ... ) { var dynamicLayerInfos = []; var dynamicLayerInfo = new DynamicLayerInfo(); dynamicLayerInfo.id = 1; var dataSource = new QueryDataSource(); dataSource.workspaceId = "d203_db"; dataSource.query = "SELECT * FROM sde.sde.states_geom"; var layerSource = new LayerDataSource(); layerSource.dataSource = dataSource; dynamicLayerInfo.source = layerSource; dynamicLayerInfos.push(dynamicLayerInfo); dynamicData.setDynamicLayerInfos(dynamicLayerInfos); ... });
Set the version for the ArcGIS DynamicMapServiceLayer. Requires an ArcGIS Server service 10.1 or greater (Added at v2.7)
Parameters: <String
> gdbVersion Required The name of the version to display. <Boolean
> doNotRefresh Optional When true the layer will not refresh the map image. The default value is false. Added at version 2.7. Sample:
layer.setGDBVersion("sde.dynamicLayers");
Sets the image format of the exported map.
Parameters: <String
> imageFormat Required Valid values are png | png8 | png24 | png32 | jpg | pdf | bmp | gif | svg.
Note: The png32 image format is only supported by msd based services published with version 10 or greater. View the service's 'Supported image Format Types' value for the map service to determine which formats are supported. The map server performs antialiasing when requesting png32 for an optimized map service.
<Boolean
> doNotRefresh Optional Added at version 2.2 When true the layer will not refresh the map image. The default value is false.
Sets the background of a dynamic image to transparent.
Parameters: <Boolean
> transparent Required Valid values are true | false. The default is "true". <Boolean
> doNotRefresh Optional Added at version 2.2 When true the layer will not refresh the map image. The default value is false.
Set the infoTemplates
property. (Added at v3.10)
Object
> infoTemplates Required infoTemplates
object. See the infoTemplates
property for details.
Sets the layer definitions used to filter the features of individual layers in the map service. If the layer definition expression is longer than approximately 2000 characters you will need to set up a
proxy page.
Layer definitions with semicolons or colons are supported if using a map service published using ArcGIS Server 10.
Parameters: <String[]
> layerDefinitions Required An array containing each layer's definition. <Boolean
> doNotRefresh Optional Added at version 2.2 When true the layer will not refresh the map image. The default value is false. Sample:
The layerDefinitions argument is an array of layer definition expressions such as in the code snippet below.
var layerDefinitions = []; layerDefinitions[0] = "POPULATION > 5000000"; layerDefinitions[5] = "AREA > 100000"; dynamicMapServiceLayer.setLayerDefinitions(layerDefinitions);
Note that the array indices 0 and 5 are valid layer IDs, and POPULATION and AREA are valid attribute fields associated with the respective layers. Definition expressions for layers that are currently not visible will be ignored by the server.
Specify an array of LayerDrawingOptions that override the way the layers are drawn. (Added at v2.7)
Parameters: <LayerDrawingOptions[]
> layerDrawingOptions Required An array of layer drawing options. <Boolean
> doNotRefresh Optional When true the layer will not refresh the map image. The default value is false. Sample:
require([ "esri/layers/LayerDrawingOptions", "esri/renderers/SimpleRenderer", ... ], function(LayerDrawingOptions, SimpleRenderer, ... ) { var layerDrawingOptions = []; var layerDrawingOption = new LayerDrawingOptions(); layerDrawingOption.renderer = new SimpleRenderer(mySymbol); layerDrawingOptions[1] = layerDrawingOption; dynamicData.setLayerDrawingOptions(layerDrawingOptions); ... });
Sets the time-related options for the layer. (Added at v2.0)
Parameters: <LayerTimeOptions[]
> options Required Array of LayerTimeOptions objects that allow you to override how a layer is exported in reference to the map's time extent. There is one object per sub-layer. In the following example, array indices 2 and 5 are valid sub-layer IDs.
require([ "esri/layers/LayerTimeOptions", "esri/layers/TimeInfo", ... ], function(LayerTimeOptions, TimeInfo, ... ) { var timeOption1 = new LayerTimeOptions(); timeOption1.timeOffset = 4; timeOption1.timeOffsetUnits = TimeInfo.UNIT_YEARS; var options = []; options[2]= timeOption1; options[5] = timeOption2; imageParameters.layerTimeOptions = options; ... });<
Boolean
> doNotRefresh Optional When true the layer will not refresh the map image. The default value is false. Added at version 2.2.
Set the maximum scale for the layer. (Added at v3.1)
Parameters: <Number
> scale Required The maximum scale at which the layer is visible.
Set the minimum scale for the layer. (Added at v3.1)
Parameters: <Number
> scale Required The minimum scale at which the layer is visible.
Sets the opacity of the layer. Values range from 0.0 to 1.0, where 0.0 is 100% transparent and 1.0 has no transparency.
Parameters: <Number
> opacity Required Value from 0 to 1, where 0 is 100% transparent and 1 has no transparency. The default value is 1. Sample:
layer.setOpacity(0.5);
Changes the layer's refresh interval to the given value (in minutes). Non-zero value sets up automatic layer refresh at the specified interval. Value of 0 stops auto refresh. (Added at v3.7)
Parameters: <Number
> interval Required Refresh interval of the layer in minutes. Non-zero value indicates automatic layer refresh at the specified interval. Value of 0
indicates auto refresh is not enabled.
Set the scale range for the layer. If minScale
and maxScale
are set to 0 then the layer will be visible at all scales. (Added at v3.1)
Number
> minScale Required The minimum scale at which the layer is visible. <Number
> maxScale Required The maximum scale at which the layer is visible.
Determine if the layer will update its content based on the map's current time extent. Default value is true. (Added at v2.2)
Parameters: <Boolean
> update Required When false the layer will not update its content based on the map's time extent. Default value is true.
Sets the visibility of the layer. When true, the layer is visible.
Parameters: <Boolean
> isVisible Required Set the visibility of the layer.
Sets the visible layers of the exported map. By default, the visible layers are as defined by the default visibility in
LayerInfo. To display no visible layers specify an array with a value of -1.
if(visible.length === 0){ visible.push(-1); } layer.setVisibleLayers(visible);Parameters: <
Number[]
> ids Required Array of layer IDs. <Boolean
> doNotRefresh Optional When true the layer will not refresh the map image. The default value is false. Added at version 2.2. Sample:
require([ "esri/layers/ArcGISDynamicMapServiceLayer" ,"dojo/query", ... ], function(ArcGISDynamicMapServiceLayer, query, ... ) { var layer = new ArcGISDynamicMapServiceLayer( ... ); var inputs = query(".list_item"), input; visible = []; for (var i=0, il=inputs.length; i< il; i++) { if (inputs[i].checked) { visible.push(inputs[i].id); } } layer.setVisibleLayers(visible); ... });
Sets the visibility of the layer to "true".
Suspends layer drawing. (Added at v3.1)
Event Details
[ On Style Events | Connect Style Event ]
Fires when there is a problem retrieving a layer. Should be used in favor of onError. (Added at v3.5)
Fired when the geodatabase version is switched. (Added at v3.6)
Fires after layer properties for the layer are successfully populated. This event must be successful before the layer can be added to the map. Should be used in favor of onLoad. (Added at v3.5)
Event Object Properties: <Layer
> layer The loaded layer.
Fires when the map export is completed. (Added at v3.6)
Event Object Properties: <MapImage
> mapImage Contains the properties of a dynamically generated map image.
Fires when the layer opacity has been changed, and returns an object with the opacity value. Should be used in favor of onOpacityChange. (Added at v3.5)
Event Object Properties: <Number
> opacity Fires when the layer opacity (transparency) changes. A number property named opacity that indicates the new opacity. Values range from 0.0 to 1.0, where 0.0 is 100% transparent and 1.0 has no transparency.
This event is fired when the layer's refreshInterval
is modified. (Added at v3.7)
Fires when a layer resumes drawing. (Added at v3.6)
Fires when a layer's minScale and/or maxScale is changed. (Added at v3.6)
Fires when a layer's scale visibility changes. The scale visibility changes when a layer is initially visible and becomes invisible because the map scale does not intersect the layer's scale range or vice versa. (Added at v3.6)
Fires when a layer suspends drawing. (Added at v3.6)
Fires when a layer has finished updating its content. It is the responsibility of the subclass to determine when this event is fired. Should be used in favor of onUpdateEnd. (Added at v3.5)
Event Object Properties: <Error
> error Optional argument. The error object is available when an error occurs during the update.
Fires when a layer begins to update its content. It is the responsibility of the subclass to determine when this event is fired. Should be used in favor of onUpdateStart. (Added at v3.5)
Fires when the layer visibility has been changed, and returns an object with a Boolean visible property containing the new visibility value of the layer. Should be used in favor of onVisibilityChange. (Added at v3.5)
Event Object Properties: <Boolean
> visible Fires when the layer visibility changes. A boolean property named visible indicates whether or not the layer is visible after visibility changed.
Fires when the visibleLayers
property is changed. (Added at v3.13)
Number[]
> visibleLayers An array of visibleLayers by index. Sample:
require([ ... ], function(...) layer.on('visible-layers-change', function(e) { console.log ('The layer(s) changed: ', e.visibleLayers.join(', ')); }); ... });
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4