Dynamic Layer / Table

Description

A dynamic layer / table resource represents a single layer / table of a map service published by ArcGIS Server or of a registered workspace. This resource is supported only when the map service supports dynamic layers, as indicated by supportsDynamicLayers on the map service resource.

For a dynamic layer / table based on an existing map service layer, this resource returns updated information based on any changes to the data. For example, consider the case of a time-aware layer in a map service. Prior to 10.1 the layer resource for such a layer would return information based on data that was cached the last time the service was refreshed. At 10.1, there are couple of options to retrieve updated temporal extents - pass returnUpdates parameter to static layer resource or request the layer via dynamicLayer resource, which would return the most current information rather than returning the cached information.

NoteNote:

If a map service layer is based on non-real-time data, it is optimal to use layer resource rather than dynamic layer resource to retrieve information regarding such a layer / table.

If dynamicLayer resource lists canModifyLayer to be false, then only the label properties specified in drawingInfo are honored. Use showLabels to turn on/off labels and use labelingInfo to specify how the labels are drawn.

supportsStatistics and supportsAdvancedQueries are dependent on the layer data source.

supportsStatistics would return false in the following scenarios:

supportsAdvancedQueries would return false in the following scenarios:

New in 10.2

New in 10.1 SP1

Resource Hierarchy

Layer

Response Parameters

Parameter

Details

f

Description: The response format. The default response format is html.

Values: html | json | pjson

layer

Description: Dynamic layer/table source definition.

NoteNote:

Assigning each layer an unique value for id would ensure that clients can correctly map the results back to the layer. This value should be different from any of the existing map service layer id.

Syntax:

{
    "id": <layerOrTableId>,
    "source": <layer source>, //required
    "definitionExpression": "<definitionExpression>",
    "drawingInfo": 
    {
      "renderer": <renderer>,
      "transparency": <transparency>,
      "scaleSymbols": <true | false>,
      "showLabels": <true | false>,
      "labelingInfo": <labeling info>
    },
    "layerTimeOptions": //supported only for time enabled map layers
    {
      "useTime" : <true | false>,
      "timeDataCumulative" : <true | false>,
      "timeOffset" : <timeOffset>,
      "timeOffsetUnits" : "<esriTimeUnitsCenturies | esriTimeUnitsDays | esriTimeUnitsDecades | 
                             esriTimeUnitsHours | esriTimeUnitsMilliseconds | esriTimeUnitsMinutes | 
                             esriTimeUnitsMonths | esriTimeUnitsSeconds | esriTimeUnitsWeeks | esriTimeUnitsYears |
                             esriTimeUnitsUnknown>"
    }
  }

Example Usage

Example 1: Get information about layerId 3 in the Census map service on servicesbeta2 using dynamicLayer:

http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/dynamicLayer?layer={"id":101,"definitionExpression":"\"sub_region\" like 'Pacific'","source":{"type":"mapLayer","mapLayerId":3}}&f=html

JSON Response Syntax

{
"currentVersion": <currentVersion>,
"id" : <layerOrTableId>,
"name" : "<layerOrTableName>",
"type" : "<layerOrTableType>", //for tables, the type will be "Table"
"description" : "<description>",
"definitionExpression" : "<definitionExpression>",

//properties specific to layers only
"geometryType" : "<geometryType>",
"hasZ" : <true|false>, //added in 10.1
"hasM" : <true|false>, //added in 10.1
"copyrightText" : "<copyrightText>",
"parentLayer" : {"id" : <parentLayerId>, "name" : "<parentLayerName>"},
"subLayers" : [
    {"id" : <subLayerId1>, "name" : "<subLayerName1>"},
    {"id" : <subLayerId2>, "name" : "<subLayerName2>"}
],
"minScale" : <minScale>,
"maxScale" : <maxScale>,
"extent" :  <envelope>,
"timeInfo" : {
  "startTimeField" : "<startTimeFieldName>",
  "endTimeField" : "<endTimeFieldName>",
  "trackIdField" : "<trackIdFieldName>",
  "timeExtent" : [<startTime>, <endTime>],
  "timeReference" : {
    "timeZone" : "<timeZone>",
    "respectsDaylightSaving" : <true | false>
  },
  "timeInterval" : <timeInterval>,
  "timeIntervalUnits" : "<timeIntervalUnits>",
  //the default time-related export options for this layer
  "exportOptions" : { 
    //If true, use the time extent specified by the time parameter
    "useTime" : < true | false >,
    //If true, draw all the features from the beginning of time for that data
    "timeDataCumulative" : < true | false >,
    //Time offset for this layer so that it can be overlaid on the top of a previous or future time period
    "timeOffset" : <timeOffset1>,
    "timeOffsetUnits" : "<esriTimeUnitsCenturies | esriTimeUnitsDays | esriTimeUnitsDecades | 
                             esriTimeUnitsHours | esriTimeUnitsMilliseconds | esriTimeUnitsMinutes | 
                             esriTimeUnitsMonths | esriTimeUnitsSeconds | esriTimeUnitsWeeks | esriTimeUnitsYears |
                             esriTimeUnitsUnknown>"
  }
  "hasLiveData" : <true | false>,
},

"drawingInfo" : {
  "renderer" : <renderer>,
  "transparency" : <transparency>,
  "labelingInfo" : <labelingInfo>
},

"hasAttachments" : <true | false>,

"htmlPopupType" : "<esriServerHTMLPopupTypeNone | esriServerHTMLPopupTypeAsURL | esriServerHTMLPopupTypeAsHTMLText>",

//layer / table field information
"displayField" : "<displayFieldName>",
"typeIdField" : "<typeIFieldName>",
"fields" : [
    {"name" : "<fieldName1>", "type" : "<fieldType1>", "alias" : "<fieldAlias1>", "length" : "<length1>", "domain" : <domain1>},
    {"name" : "<fieldName2>", "type" : "<fieldType2>", "alias" : "<fieldAlias2>", "length" : "<length2>", "domain" : <domain2>}
],
"types" : [
  {
    "id" : <typeId1>,
    "name" : "<typeName1>",
    "domains" : {
      "<domainField11>" : <domain11>,
      "<domainField12>" : <domain12>
    }
  },
  {
    "id" : <typeId2>,
    "name" : "<typeName2>",
    "domains" : {
      "<domainField11>" : <domain21>,
      "<domainField12>" : <domain22>
    }
  }
],

"relationships" : [
  {
    "id" : <relationshipId1>,
    "name" : "<relationshipName1>",
    "relatedTableId" : <relatedTableId1>,
    "role" : "<esriRelRoleOrigin>|<esriRelRoleDestination>";,//Added at 10.1
    "cardinality" : "<esriRelCardinalityOneToOne>|<esriRelCardinalityOneToMany>|<esriRelCardinalityManyToMany>";,//Added at 10.1
    "keyField" : "<keyFieldName2>",//Added at 10.1
    "isComposite" : <true>|<false>,//Added at 10.1
    "relationshipTableId": <attributedRelationshipClassTableId>,  //Added in 10.1. Returned only for attributed relationships
    "keyFieldInRelationshipTable": "<key field in AttributedRelationshipClass table that matches keyField>" //Added in 10.1. Returned only for attributed relationships
  },
  {
    "id" : <relationshipId2>,
    "name" : "<relationshipName2>",
    "relatedTableId" : <relatedTableId2>,
    "role" : "<esriRelRoleOrigin>|<esriRelRoleDestination>";,//Added at 10.1
    "cardinality" : "<esriRelCardinalityOneToOne>|<esriRelCardinalityOneToMany>|<esriRelCardinalityManyToMany>";,//Added at 10.1
    "keyField" : "<keyFieldName2>",//Added at 10.1
    "isComposite" : <true>|<false>,//Added at 10.1
    "relationshipTableId": <attributedRelationshipClassTableId>,  //Added in 10.1. Returned only for attributed relationships
    "keyFieldInRelationshipTable": "<key field in AttributedRelationshipClass table that matches keyField>" //Added in 10.1. Returned only for attributed relationships
  }
],
"maxRecordCount": <recordCount>,
"canModifyLayer": <true | false>,
if the layer / table supports statistical functions in query operation
"supportsStatistics": <true | false>,
if the layer / table supports orderBy parameter in query operation
"supportsAdvancedQueries": <true | false>,
//new at 10.1 - if the layer has labels defined on it.
"hasLabels": <true | false>,
//new at 10.1 - if the layer renderers its symbols based on scale.
"canScaleSymbols": <true | false>,
//comma separated list of supported capabilities - e.g. "Map,Query,Data"
"capabilities" : "<capabilities>",
//comma separated list of supported query output formats - e.g. "JSON, AMF"
"supportedQueryFormats" : "<supported query output formats>",
//effectiveMinScale and effectiveMaxScale are returned only for dynamic map layers.
"effectiveMinScale":<effective minimum scale>,
"effectiveMaxScale":<effective maximummum scale>,
//true if the layer is versioned.
"isDataVersioned": <true | false>,
//new at 10.1 SP1.
"ownershipBasedAccessControlForFeatures": 
{
 "allowOthersToQuery": <true | false>
},
//new at 10.2
"useStandardizedQueries": <true | false>
}

JSON Response Example

{
 "currentVersion": 10.1,
 "name": "states",
 "type": "Feature Layer",
 "description": "This service presents various population statistics from Census 2000, including total population, population density, racial counts, and more. The map service presents statistics at the state, county, block group, and block point levels.\n",
 "definitionExpression": "\"sub_region\" like 'Pacific'",
 "geometryType": "esriGeometryPolygon",
 "copyrightText": "US Bureau of the Census: http://www.census.gov",
 "subLayers": [
  
 ],
 "minScale": 0,
 "maxScale": 0,
 "drawingInfo": {
  "renderer": {
   "type": "simple",
   "symbol": {
    "type": "esriSFS",
    "style": "esriSFSSolid",
    "color": [
     0,
     0,
     0,
     0
    ],
    "outline": {
     "type": "esriSLS",
     "style": "esriSLSSolid",
     "color": [
      0,
      0,
      0,
      255
     ],
     "width": 2
    }
   },
   "label": "",
   "description": ""
  },
  "transparency": 0,
  "labelingInfo": null
 },
 "defaultVisibility": true,
 "extent": {
  "xmin": -178.21759836267427,
  "ymin": 18.921786344664099,
  "xmax": -66.969271036229316,
  "ymax": 71.406235367068575,
  "spatialReference": {
   "wkid": 4269,
   "latestWkid": 4269
  }
 },
 "hasAttachments": false,
 "htmlPopupType": null,
 "displayField": "STATE_NAME",
 "typeIdField": null,
 "fields": [
  {
   "name": "OBJECTID",
   "type": "esriFieldTypeOID",
   "alias": "OBJECTID",
   "domain": null
  },
  {
   "name": "STATE_NAME",
   "type": "esriFieldTypeString",
   "alias": "STATE_NAME",
   "length": 25,
   "domain": null
  },
  {
   "name": "STATE_FIPS",
   "type": "esriFieldTypeString",
   "alias": "STATE_FIPS",
   "length": 2,
   "domain": null
  },
  {
   "name": "SUB_REGION",
   "type": "esriFieldTypeString",
   "alias": "SUB_REGION",
   "length": 20,
   "domain": null
  },
  {
   "name": "STATE_ABBR",
   "type": "esriFieldTypeString",
   "alias": "STATE_ABBR",
   "length": 2,
   "domain": null
  },
  {
   "name": "POP2000",
   "type": "esriFieldTypeInteger",
   "alias": "POP2000",
   "domain": null
  },
  {
   "name": "POP2007",
   "type": "esriFieldTypeInteger",
   "alias": "POP2007",
   "domain": null
  },
  {
   "name": "POP00_SQMI",
   "type": "esriFieldTypeDouble",
   "alias": "POP00_SQMI",
   "domain": null
  },
  {
   "name": "POP07_SQMI",
   "type": "esriFieldTypeDouble",
   "alias": "POP07_SQMI",
   "domain": null
  },
  {
   "name": "WHITE",
   "type": "esriFieldTypeInteger",
   "alias": "WHITE",
   "domain": null
  },
  {
   "name": "BLACK",
   "type": "esriFieldTypeInteger",
   "alias": "BLACK",
   "domain": null
  },
  {
   "name": "AMERI_ES",
   "type": "esriFieldTypeInteger",
   "alias": "AMERI_ES",
   "domain": null
  },
  {
   "name": "ASIAN",
   "type": "esriFieldTypeInteger",
   "alias": "ASIAN",
   "domain": null
  },
  {
   "name": "HAWN_PI",
   "type": "esriFieldTypeInteger",
   "alias": "HAWN_PI",
   "domain": null
  },
  {
   "name": "OTHER",
   "type": "esriFieldTypeInteger",
   "alias": "OTHER",
   "domain": null
  },
  {
   "name": "MULT_RACE",
   "type": "esriFieldTypeInteger",
   "alias": "MULT_RACE",
   "domain": null
  },
  {
   "name": "HISPANIC",
   "type": "esriFieldTypeInteger",
   "alias": "HISPANIC",
   "domain": null
  },
  {
   "name": "MALES",
   "type": "esriFieldTypeInteger",
   "alias": "MALES",
   "domain": null
  },
  {
   "name": "FEMALES",
   "type": "esriFieldTypeInteger",
   "alias": "FEMALES",
   "domain": null
  },
  {
   "name": "AGE_UNDER5",
   "type": "esriFieldTypeInteger",
   "alias": "AGE_UNDER5",
   "domain": null
  },
  {
   "name": "AGE_5_17",
   "type": "esriFieldTypeInteger",
   "alias": "AGE_5_17",
   "domain": null
  },
  {
   "name": "AGE_18_21",
   "type": "esriFieldTypeInteger",
   "alias": "AGE_18_21",
   "domain": null
  },
  {
   "name": "AGE_22_29",
   "type": "esriFieldTypeInteger",
   "alias": "AGE_22_29",
   "domain": null
  },
  {
   "name": "AGE_30_39",
   "type": "esriFieldTypeInteger",
   "alias": "AGE_30_39",
   "domain": null
  },
  {
   "name": "AGE_40_49",
   "type": "esriFieldTypeInteger",
   "alias": "AGE_40_49",
   "domain": null
  },
  {
   "name": "AGE_50_64",
   "type": "esriFieldTypeInteger",
   "alias": "AGE_50_64",
   "domain": null
  },
  {
   "name": "AGE_65_UP",
   "type": "esriFieldTypeInteger",
   "alias": "AGE_65_UP",
   "domain": null
  },
  {
   "name": "MED_AGE",
   "type": "esriFieldTypeDouble",
   "alias": "MED_AGE",
   "domain": null
  },
  {
   "name": "MED_AGE_M",
   "type": "esriFieldTypeDouble",
   "alias": "MED_AGE_M",
   "domain": null
  },
  {
   "name": "MED_AGE_F",
   "type": "esriFieldTypeDouble",
   "alias": "MED_AGE_F",
   "domain": null
  },
  {
   "name": "HOUSEHOLDS",
   "type": "esriFieldTypeInteger",
   "alias": "HOUSEHOLDS",
   "domain": null
  },
  {
   "name": "AVE_HH_SZ",
   "type": "esriFieldTypeDouble",
   "alias": "AVE_HH_SZ",
   "domain": null
  },
  {
   "name": "HSEHLD_1_M",
   "type": "esriFieldTypeInteger",
   "alias": "HSEHLD_1_M",
   "domain": null
  },
  {
   "name": "HSEHLD_1_F",
   "type": "esriFieldTypeInteger",
   "alias": "HSEHLD_1_F",
   "domain": null
  },
  {
   "name": "MARHH_CHD",
   "type": "esriFieldTypeInteger",
   "alias": "MARHH_CHD",
   "domain": null
  },
  {
   "name": "MARHH_NO_C",
   "type": "esriFieldTypeInteger",
   "alias": "MARHH_NO_C",
   "domain": null
  },
  {
   "name": "MHH_CHILD",
   "type": "esriFieldTypeInteger",
   "alias": "MHH_CHILD",
   "domain": null
  },
  {
   "name": "FHH_CHILD",
   "type": "esriFieldTypeInteger",
   "alias": "FHH_CHILD",
   "domain": null
  },
  {
   "name": "FAMILIES",
   "type": "esriFieldTypeInteger",
   "alias": "FAMILIES",
   "domain": null
  },
  {
   "name": "AVE_FAM_SZ",
   "type": "esriFieldTypeDouble",
   "alias": "AVE_FAM_SZ",
   "domain": null
  },
  {
   "name": "HSE_UNITS",
   "type": "esriFieldTypeInteger",
   "alias": "HSE_UNITS",
   "domain": null
  },
  {
   "name": "VACANT",
   "type": "esriFieldTypeInteger",
   "alias": "VACANT",
   "domain": null
  },
  {
   "name": "OWNER_OCC",
   "type": "esriFieldTypeInteger",
   "alias": "OWNER_OCC",
   "domain": null
  },
  {
   "name": "RENTER_OCC",
   "type": "esriFieldTypeInteger",
   "alias": "RENTER_OCC",
   "domain": null
  },
  {
   "name": "NO_FARMS97",
   "type": "esriFieldTypeDouble",
   "alias": "NO_FARMS97",
   "domain": null
  },
  {
   "name": "AVG_SIZE97",
   "type": "esriFieldTypeDouble",
   "alias": "AVG_SIZE97",
   "domain": null
  },
  {
   "name": "CROP_ACR97",
   "type": "esriFieldTypeDouble",
   "alias": "CROP_ACR97",
   "domain": null
  },
  {
   "name": "AVG_SALE97",
   "type": "esriFieldTypeDouble",
   "alias": "AVG_SALE97",
   "domain": null
  },
  {
   "name": "SQMI",
   "type": "esriFieldTypeInteger",
   "alias": "SQMI",
   "domain": null
  },
  {
   "name": "Shape",
   "type": "esriFieldTypeGeometry",
   "alias": "Shape",
   "domain": null
  },
  {
   "name": "Shape_Length",
   "type": "esriFieldTypeDouble",
   "alias": "Shape_Length",
   "domain": null
  },
  {
   "name": "Shape_Area",
   "type": "esriFieldTypeDouble",
   "alias": "Shape_Area",
   "domain": null
  }
 ],
 "relationships": [
  
 ],
 "canModifyLayer": true,
 "canScaleSymbols": false,
 "hasLabels": false,
 "capabilities": "Map,Query,Data",
 "maxRecordCount": 1000,
 "supportsStatistics": true,
 "supportsAdvancedQueries": true,
 "supportedQueryFormats": "JSON, AMF",
 "id": 101,
 "ownershipBasedAccessControlForFeatures": 
 {
  "allowOthersToQuery": true
 },
 //new at 10.2
 "useStandardizedQueries": true
}