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. There are a couple of options to retrieve updated temporal extents—pass the 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 nonreal-time data, it is optimal to use layer resource rather than dynamic layer resource to retrieve information regarding such a layer / table.

If the dynamicLayer resource lists canModifyLayer to be false, 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:

Features added throughout prior releases

10.7.1

  • supportedQueryFormats now includes pbf (protocol buffer), a compact binary encoding for geographic data.

10.6.1

  • A new property named archivingInfo is added.
  • The supportsCountDistinct property is added inside the advancedQueryCapabilities element.
  • A new property named hasMetadata is added. This value is true when the service is published using ArcGIS Pro 2.2 or later, false otherwise.
  • If hasMetadata is true, the layer / table supports the iteminfo, thumbnail, and metadata resources.

10.6

  • A new property named displayFieldExpressionInfo is added; it returns the tile of the expression and an Arcade expression.
    • When a layer is authored with displayExpression, its resources still report displayField, which is a field picked from the Arcade expression or the default displayField in case the expression does not have any field in it.

10.5.1

  • returnDomainNames is a parameter on the layer resource where domain information includes only the domain name. The domain names can be matched with the full domain information as returned by the queryDomains operation. This approach is a more efficient way to work with domains, as it requires returning the full domain information only once instead of with each layer.

10.5

  • Layer reports its sourceSpatialReference, which can be different than what is in its extent or its container map service's spatial reference.
  • Added the following new flags:
    • supportsDatumTransformation indicates the layer supports datum transformation while query results get projected.
    • supportsSqlExpression indicates that the layer/table supports sql expressions in query operation's orderBy, groupByFieldsForStatistics, and outStatistics.
  • New properties are added to report ranges and parameterized filters:
    • rangeInfos returns a list of available ranges including their names, current values, and full extent.
    • parameterInfos returns a list of available parameterized filters. These are preauthored filters to limit what you want to query or display. This is like layerDefs except that layerDefs requires you to pass in an entire sql where clause whereas for parameterized filters, you need to pass in the name-value pair.
  • The returnUpdates response includes updated full spatial extent when the layer is from an enterprise geodatabase.

10.3.1

  • supportsStatistics supports Query Layers, for example, such as layers / tables defined by a SQL query from a database, geodatabase archived layer, and so on.
  • Layers from file geodatabases support pagination (supportsPagination property). Other supported workspaces include Altibase, Hana, Oracle 12c (and later releases), PostgreSQL, SQLite, and SQL Server 2012 (and later releases). The following are not supported: DB2, Informix, Netezza, and Teradata.

10.3

  • All properties related to query are grouped inside advancedQueryCapabilities.
  • A new property is reported to indicate whether the layer supports pagination in a query result—supportsPagination.
  • supportsTrueCurve is always true and indicates whether the service supports accepting and returning true curves as a segment of a polyline or polygon.
  • supportsAdvancedQueries is split into supportsOrderBy and supportsDistinct.

10.2

  • A new property is reported to indicate whether the layer requires the use of standardized queries—useStandardizedQueries. A value of true indicates the layer requires the use of standardized queries, a value of false indicates otherwise. Learn more about standardized queries.
  • Layer / table resources no longer report the existing definition expression set in the source map document.

10.1 SP1

  • If ownership-based access control is enabled on features, the ownershipBasedAccessControlForFeatures property of a layer will include an allowOthersToQuery property.

Response parameters

Parameter

Details

f

The response format. The default response format is html.

Values: html | json | pjson

layer

Dynamic layer/table source definition.

NoteNote:

Assigning each layer a unique value for id would ensure that clients can correctly map the results back to the layer. This value should be different from any 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:

https://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"
"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: https://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, geoJSON, PBF",
 "id": 101,
 "ownershipBasedAccessControlForFeatures": 
 {
  "allowOthersToQuery": true
 },
 //introduced at 10.2
 "useStandardizedQueries": true
}