Layer source object

Overview

This is supported at ArcGIS 10.1 and later.

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

There are two types of layerSource objects:

Dynamic map layer

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

NoteNote:

type and mapLayerId are required elements.

JSON syntax

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

JSON example

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

Dynamic data layer

A 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 follows:

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

NoteNote:

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"}
    ]
 }

3/3/2017