Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: DynamicLayerInfo

require(["esri/layers/DynamicLayerInfo"], function(DynamicLayerInfo) { /* code goes here */ });

Description

(Added at v2.7)
Information about each layer in a map service. This class extends the LayerInfo class with a new property source which can be either a LayerMapSource or a LayerDataSource.

See also

Samples

Search for samples that use this class.

Class hierarchy

esri/layers/LayerInfo
|_esri/layers/DynamicLayerInfo

Constructors

NameSummary
new DynamicLayerInfo(json?)Creates a new DynamicLayerInfo object.

Properties

NameTypeSummary
defaultVisibilityBooleanDefault visibility of the layers in the map service.
idNumberLayer ID assigned by ArcGIS Server for a layer.
maxScaleNumberThe maximum visible scale for each layer in the map service.
minScaleNumberThe minimum visible scale for each layer in the map service.
nameStringLayer name as defined in the map service.
parentLayerIdNumberIf the layer is part of a group layer, it will include the parent ID of the group layer.
sourceLayerSourceThe source for the dynamic layer can be either a LayerMapSource or LayerDataSource.
subLayerIdsNumber[]If the layer is a parent layer, it will have one or more sub layers included in an array.

Methods

NameReturn typeSummary
toJson()ObjectConverts object to its ArcGIS Server JSON representation.
Constructor Details

new DynamicLayerInfo(json?)

Creates a new DynamicLayerInfo object.
Parameters:
<Object> json Optional JSON object representing the DynamicLayerInfo.
require([
  "esri/layers/DynamicLayerInfo", ... 
], function(DynamicLayerInfo, ... ) {
  var dynamicLayerInfo = new DynamicLayerInfo({
    "defaultVisibility": true,
    "id": 0,
    "maxScale": 1000000,
    "minScale": 0,
    "parentLayerId": -1
  });
  ...
});
Property Details

<Boolean> defaultVisibility

Default visibility of the layers in the map service.
Known values: true | false

<Number> id

Layer ID assigned by ArcGIS Server for a layer. The topmost layer is 0, and each layer follows sequentially. If a layer is added or removed from the source map document, the ID values will shift accordingly.
Sample:

dynamicLayerInfo.id = 0;

<Number> maxScale

The maximum visible scale for each layer in the map service. If the map is zoomed in beyond this scale the layer will not be visible. A value of 0 means that the layer does not have a maximum scale. This property is only available for map services published using ArcGIS Server 10 SP1 or later.
Sample:

dynamicLayerInfo.maxScale = 1000000;

dynamicLayerInfo.minScale = 0;

<Number> minScale

The minimum visible scale for each layer in the map service. If the map is zoomed out beyond this scale the layer will not be visible. A value of 0 means that the layer does not have a minimum scale. This property is only available for map services published using ArcGIS Server 10 SP1 or later.
Sample:

dynamicLayerInfo.maxScale = 1000000;

dynamicLayerInfo.minScale = 0;

<String> name

Layer name as defined in the map service.

<Number> parentLayerId

If the layer is part of a group layer, it will include the parent ID of the group layer. Otherwise, the value is -1. If a layer is added or removed from the source map document, the ID values will shift accordingly.

<LayerSource> source

The source for the dynamic layer can be either a LayerMapSource or LayerDataSource. Requires ArcGIS Server 10.1 service.
Sample:
require([
  "esri/layers/DynamicLayerInfo", "esri/layers/TableDataSource", ... 
], function(DynamicLayerInfo, TableDataSource, ... ) {
  var dataSource = new TableDataSource();
  dataSource.workspaceId = "d203";
  dataSource.dataSourceName = "sde.SDE.states";

  var dynamicLayerInfo = new DynamicLayerInfo( ... );
  var layerSource = new LayerDataSource();
  layerSource.dataSource = dataSource;
  dynamicLayerInfo.source = layerSource;
  ...
});

<Number[]> subLayerIds

If the layer is a parent layer, it will have one or more sub layers included in an array. Otherwise, the value is null. If a layer is added or removed from the source map document, the ID values will shift accordingly.
Method Details

toJson()

Converts object to its ArcGIS Server JSON representation.
Return type: Object
Show Modal