FRAMES | NO FRAMES
Layer Source Object

Overview

This is supported from 10.1 onwards.

This document discusses the JSON representation used to describe a layerSource object.

There are two types of layerSource objects:

Dynamic map layer

Dynamic map layer refers to a layer in the current map service. If supported, use gdbVersion to specify an alternate geodatabase version.

Note: type and mapLayerId are required.

JSON Syntax

{
    "type": "mapLayer", //required
    "mapLayerId": <layerId>, //required
    "gdbVersion": "<version name>"
}

JSON Example

{
    "type": "mapLayer",
    "mapLayerId": 3,
    "gdbVersion": "SDE.dynamicLayers"
}

Dynamic data layer

Dynamic data layer is an on-the-fly layer created off of data from a registered workspace. Depending on the type of dataSource these layers are classified as:


Use fields to control field visibility. If this value is null, then all the fields would be visible on the dynamicLayer.


Note: type and dataSource are required elements.

JSON Syntax

 {
    "type": "dataLayer", //required
    "dataSource": <dataSource>, //required
    "fields":
    [
      {"name":"<fieldName1>","alias":"<fieldAlias1>"},
      {"name":"<fieldName2>","alias":"<fieldAlias2>"}
    ]
 }

JSON Example

 {
    "type": "dataLayer",
    "dataSource": 
    {
      "type": "table",
      "workspaceId": "MAP",
      "dataSourceName": "SDE.Counties",
      "gdbVersion": "SDE.dynamicLayers"
    },
    "fields": [
      {"name":"name","alias":"County Name"},
      {"name":"fips","alias":"County FIPS"}
    ]
 }