Overview
This topic discusses the JSON representation used to describe a layerSource object.
There are three types of layerSource objects:
- Dynamic map layer - Refers to an existing map service layer
- Dynamic data layer - Refers to a layer created on-the-fly from a dataSource
- Dynamic workspace layer - Refers to a pre-authored Layer File (.lyrx) from a registered folder.
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.
Note:
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:
- Dynamic table data layer—Source data from a table data source
- Dynamic queryTable data layer—Source data from a queryTable data source
- Dynamic raster data layer—Source data from a raster data source
- Dynamic join data layer—Source data from a joinTable data source
Use fields to control field visibility. If this value is null, all fields are 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"}
]
}
Dynamic workspace layer
A dynamic workspace layer refers to a pre-authored Layer File (.lyrx) created from ArcGIS Pro. These files reside in a registered folder. It allows you to dynamically use a pre-authored layer, with an advanced renderer and cartographically enriched symbols that are not supported by map service's REST API specifications, to a map service operation on a per request basis.
Note:
type, workspaceId and layerId are required elements.
There must be only one layer in a Layer File. For example, you cannot have a group layer or any other composite layer.
The source of the layer inside a Layer File cannot be a map service, feature service, or WMS service.
JSON syntax
{
"type": "workspaceLayer", //required
"workspaceId": <registered workspace id>>, //required
"layerId": "<lyrx file name with extension>" //required
}
JSON example
{
"type": "workspaceLayer",
"workspaceId": "lyrx_folder",
"layerId": "WorldCities.lyrx"
}