Layer / Table

  • URL:http://<mapservice-url>/<layerOrTableId>
  • Required Capability:Map
  • Version Introduced:9.3

Description

Note:

Before 10.0, this resource represented only a layer. From 10.0 onward, it represents either a layer or table depending on whether the LayerOrTableId is that of a layer or a table.

The layer/table resource represents a single layer/table in a map of a map service published by ArcGIS Server. It provides basic information about the layer/table such as its name, type and fields. For layers, it provides additional information about the layer such as its parent and sub-layers, min and max scales, extent, and copyright text.

If a layer is authored with display expression and not a display field, displayField will be the first field used in the display expression.

supportsStatistics and supportsAdvancedQueries are dependent on the layer data source.

supportsStatistics would return false in the following scenarios:

  • The layer / table resides in a workspace other than an enterprise or file geodatabase.
  • The layer / table has more than one join defined on it.
  • The layer / table is joined with another layer / table from a different workspace.
  • The layer / table has an "outer" join and where the workspace is a pre-10.1 Geodatabase and application server connection is used.

supportsAdvancedQueries would return false in the following scenarios:

  • The layer / table resides in a workspace other than an enterprise database or File Geodatabase.
  • The layer / table is joined with another layer / table from a different workspace.

New in 10.6.1

  • New property named archivingInfo is added.
  • supportsCountDistinct property added inside advancedQueryCapabilities element.
  • New property named hasMetadata is added. This value is true when the service is published using ArcGISPro version 2.2 or newer, false otherwise.
  • If hasMetadata is true then the layer / table supports iteminfo, thumbnail, and metadata resources.

New in 10.6

  • New property named displayFieldExpressionInfo is added that 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.

New in 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.

New in 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 new flags:
    • supportsDatumTransformation to indicate 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 pre-authored 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 where as for parameterized filters you need to pass in the name-value pair.
  • returnUpdates response includes updated full spatial extent when the layer from an enterprise geodatabase.

New in 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.

New in 10.3

  • All properties related to query are grouped inside advancedQueryCapabilities. See section below titled 'advancedQueryCapabilities' for more information.
  • supportsPagination indicates whether the layer supports pagination in a query result.
  • supportsTrueCurve 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.

New in 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.

New in 10.1 SP1

  • If ownership-based access control is enabled on features, ownershipBasedAccessControlForFeatures property of a layer will include an allowOthersToQuery property.
  • supportsAdvancedQueries is true if the layer/table supports returnDistinctValues parameter in a query operation.

New in 10.1

  • Layer resource supports a new parameter (returnUpdates) that accepts a boolean value. Pass this parameter to retrieve updated timeExtent for the layer.
  • Layer now supports a new operation, generateRenderer. Use this to generate class breaks or a unique value renderer.
  • A new property, canModifyLayer was added. Use this property on the Layer / Table resource to determine if a layer supports modifying its renderer and/or data source.
  • Layer resource contains hasLabels to indicate if the layer has labels defined on it, and canScaleSymbols if the text and symbols on the layer will change as the map scale varies.
  • Layer resource contains hasLiveData that returns a boolean value. This value is true if the layer's data gets updated frequently. This property is independent of hasLiveData that is available on the map service resource.
  • Layer resource contains maxRecordCount that represents the maximum number of records that can be returned by query, find, and identify operations.
  • Layer resource contains supportsStatistics that indicates if the layer supports statistical functions in query operations and supportsAdvancedQueries to indicate if the layer supports orderByFields in a query operation.
  • Layer resource contains supportedQueryFormats. This value indicates the supported output formats for a query operation.
  • Layer resource contains hasZ and hasM to indicate if the layer geometry contains Z and/orM values respectively.
  • Layer resource now returns role, cardinality, keyField, composite, relationshipTableId, and keyFieldInRelationshipTable properties for relationships.
  • Layer resource now returns two new properties: effectiveMinScale and effectiveMaxScale. Effective minimum and maximum scale are calculated based on the minScale and maxScale values of the current layer and its ancestors. These represent the effective minimum and maximum scales at which the layer is visible.
  • Layer resource includes isDataVersioned if the layer is versioned.

New in 10.0

  • The layer/table resource represents a single layer/table in a map of a map service published by ArcGIS Server. It provides basic information about the layer/table such as its name, type and fields. For layers, it provides additional information about the layer such as its parent and sub-layers, min and max scales, extent, and copyright text. From 10.0 onward, it also provides information regarding the relationship of this layer/table with other layers/tables in the map service. A property to indicate whether the layer/table has attachments or not was also added at 10.0.
  • Support for time-aware layers/tables was added at 10.0. If a layer/table supports quering and exporting maps based on time, the response will include a timeInfo property that includes information such as the start time field (or the time instance field), the end time field, the track ID field, the layer's time extent, and the suggested draw time interval.

Request Parameters

ParameterDetails
f

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

Values: html | json

returnUpdates

//This option was added at 10.1.

Description: If value is true, returns updated time extent. If the layer is not time-aware, returns an empty response.

Values: true | false

returnDomainNames

This parameter was added at 10.5.1

Description: If value is true, then domain information provided in the layer includes only the domain name. To get the full domain information, use the queryDomains operation in the service resource. This domains included in the layer can be used to linked to the full domain information via the domain name. If the value is false or not set, then full domain information is included in the layer as it was in past releases.

advancedQueryCapablities

  • advancedQueryCapabilities capabilities are dependent on the support of these functionality by the layer/table's datasource. As a map service author, you do not have any control to toggle them on or off excpect for useStandardizedQueries.

    For example:

    • a layer referring to a shape file will return false for supportsStatistics, supportsOrderBy or supportsPagination etc., and you will not be able to make use of outStatistics, orderByFields or resultOffset and resultRecordCount respectively in a query operation request.
    • whereas, a layer referring to a FeatureClass from an Enterprise Database will most likely return true for supportsStatistics, supportsOrderBy, supportsPagination etc.
  • When useStandardizedQueries is true, you must conform where clause and any expression you pass in orderByFields, outStatistics etc. to ArcGIS Server standardizedQueries specifications. When it is false, you can pass in SQL expression that conforms to the source database. As an admin, you can disable StandardizedQueries for all services running on a server instance.
  • supportsStatistics indicates that you can pass values in a query operation's outStatistics parameter to get some statistical results for that layer/table.
  • supportsOrderBy indicates that you can get query result sorted by ascending or descending order based on values from one or multiple fields or expression (when supportsSqlExpression is true) by passing in values to orderByFields.
  • supportsDistinct indicates that you can make a query to retrieve unique values from a field(s) specified in the outFields.
  • supportsPagination indicates whether the layer supports paging through query result. When it is supported you can use resultOffset and/or resultRecordCount to fetch e.g. first 10 records and then make subsequent request to fetch next 10 records. To support pagination, a supported workspace must be used: Altibase, Hana, Oracle 12c (and later releases), PostgreSQL, SQLite, and SQL Server 2012 (and later releases). The following are not supported: file geodatabase, DB2, Informix, Netezza, and Teradata.
  • supportsTrueCurve indicates whether the service supports accepting and returning true curves as a segment of a polyline or polygon.
  • supportsReturningQueryExtent indicates pass true to returnExtentOnly to return an extent covering all features in a query result, instead of returning features.
  • When supportsQueryWithDistance is true, you can pass include a buffer distance in a query request.
  • supportsSqlExpression indicates that the layer/table supports sql expressions in query operation's orderBy, groupByFieldsForStatistics and outStatistics.

Example Usage

Example 1: Get information about layerId3 in the Census map service:

http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3

Example 2: Using returnUpdates to return updated temporal information, if the layer is time- enabled.

http://sampleserver6.arcgisonline.com/arcgis/rest/services/Hurricanes/MapServer/0?returnUpdates=true&f=pjson

JSON Response Syntax

{
"currentVersion": <currentVersion>, //Added at 10.0 SP1
"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>,
"effectiveMinScale" : <effectiveMinScale>,
"effectiveMaxScale" : <effectiveMaxScale>,
"defaultVisibility" : <true | false>,
"extent" :  <envelope>,

//from 10 onward - if the layer / table supports querying and exporting maps based on time
"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>,
},

//from 10.0 onward - for feature layers only
"drawingInfo" : {
  "renderer" : <renderer>,
  "transparency" : <transparency>,
  "labelingInfo" : <labelingInfo>
},

//from 10 onward - indicates whether the layer / table has attachments or not
"hasAttachments" : <true | false>,

//from 10 onward - indicates whether the layer / table has htmlPopups
"htmlPopupType" : "<esriServerHTMLPopupTypeNone | esriServerHTMLPopupTypeAsURL | esriServerHTMLPopupTypeAsHTMLText>",

//layer / table field information
"displayField" : "<displayFieldName>",
//the typeIdField is new at 10.0
"typeIdField" : "<typeIFieldName>",
//from 10.0 fields of type (String, Date, GlobalID, GUID and XML) have an additional length property
//from 10.0 onward the field domains are also included
"fields" : [
    {"name" : "<fieldName1>", "type" : "<fieldType1>", "alias" : "<fieldAlias1>", "length" : "<length1>", "domain" : <domain1>},
    {"name" : "<fieldName2>", "type" : "<fieldType2>", "alias" : "<fieldAlias2>", "length" : "<length2>", "domain" : <domain2>}
],
//new at 10.0 - if the layer has sub-types, they'll be included
"types" : [
  {
    "id" : <typeId1>,
    "name" : "<typeName1>",
    "domains" : {
      "<domainField11>" : <domain11>,
      "<domainField12>" : <domain12>
    }
  },
  {
    "id" : <typeId2>,
    "name" : "<typeName2>",
    "domains" : {
      "<domainField11>" : <domain21>,
      "<domainField12>" : <domain22>
    }
  }
],

//new at 10 - if the layer / table participates in relationships with other layers / tables
"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
    "composite" : <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
    "composite" : <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
  }
],
//Added at 10.1
"maxRecordCount": <recordCount>,
//Added at 10.1 - if the layer / table supports modifying its renderer, data source, or join information.
"canModifyLayer": <true | false>,
//Added at 10.1 - if the layer / table supports statistical functions in query operation.
"supportsStatistics": <true | false>,
//Added at 10.1 - if the layer / table supports orderBy parameter in query operation.
"supportsAdvancedQueries": <true | false>,
//Added at 10.1 - if the layer has labels defined on it.
"hasLabels": <true | false>,
//Added at 10.1 - if the layer renders 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>",
//true if the layer is versioned.
"isDataVersioned": <true | false>,
//Added at 10.1 SP1.
"ownershipBasedAccessControlForFeatures":
 //Added at 10.1 SP1.
 "allowOthersToQuery": <true | false>
 //Added at 10.3 - container for below properties.
 "advancedQueryCapabilities": {
  //Added at 10.2.
  "useStandardizedQueries": <true | false>,
  //Added at 10.3.1.
  "supportsStatistics": <true | false>,
  //Added at 10.3.
  "supportsOrderBy": true,
  //Added at 10.3.
  "supportsDistinct": true,
  //Added at 10.3.
  "supportsPagination": false,
  //Added at 10.3.
  "supportsTrueCurve": true,
 },

JSON Response Example

{
 "currentVersion": 10.31,
 "id": 0,
 "name": "BuildingPermits",
 "type": "Feature Layer",
 "description": "",
 "geometryType": "esriGeometryPoint",
 "copyrightText": "",
 "parentLayer": null,
 "subLayers": [],
 "minScale": 0,
 "maxScale": 0,
 "drawingInfo": {
  "renderer": {
   "type": "simple",
   "symbol": {
    "type": "esriSMS",
    "style": "esriSMSCircle",
    "color": [
     135,
     99,
     0,
     255
    ],
    "size": 4,
    "angle": 0,
    "xoffset": 0,
    "yoffset": 0,
    "outline": {
     "color": [
      0,
      0,
      0,
      255
     ],
     "width": 1
    }
   },
   "label": "",
   "description": ""
  },
  "transparency": 0,
  "labelingInfo": null
 },
 "defaultVisibility": true,
 "extent": {
  "xmin": -1.366377185708964E7,
  "ymin": 5699225.41829418,
  "xmax": -1.3663618388213603E7,
  "ymax": 5699411.767458527,
  "spatialReference": {
   "wkid": 102100,
   "latestWkid": 3857
  }
 },
 "hasAttachments": false,
 "htmlPopupType": "esriServerHTMLPopupTypeNone",
 "displayField": "CITYNAME",
 "typeIdField": null,
 "fields": [
  {
   "name": "RECORD",
   "type": "esriFieldTypeDouble",
   "alias": "RECORD",
   "domain": null
  },
  {
   "name": "PERMITDATE",
   "type": "esriFieldTypeDate",
   "alias": "PERMITDATE",
   "length": 36,
   "domain": null
  },
  {
   "name": "PERMIT_NO",
   "type": "esriFieldTypeString",
   "alias": "PERMIT_NO",
   "length": 15,
   "domain": null
  },
  {
   "name": "CITYNAME",
   "type": "esriFieldTypeString",
   "alias": "CITYNAME",
   "length": 17,
   "domain": null
  },
  {
   "name": "VALUE",
   "type": "esriFieldTypeDouble",
   "alias": "VALUE",
   "domain": null
  },
  {
   "name": "SQFT",
   "type": "esriFieldTypeDouble",
   "alias": "SQFT",
   "domain": null
  },
  {
   "name": "TLID",
   "type": "esriFieldTypeString",
   "alias": "TLID",
   "length": 17,
   "domain": null
  },
  {
   "name": "SUBDIV",
   "type": "esriFieldTypeString",
   "alias": "SUBDIV",
   "length": 63,
   "domain": null
  },
  {
   "name": "LOT",
   "type": "esriFieldTypeString",
   "alias": "LOT",
   "length": 11,
   "domain": null
  },
  {
   "name": "BLOCK",
   "type": "esriFieldTypeString",
   "alias": "BLOCK",
   "length": 7,
   "domain": null
  },
  {
   "name": "WORK_DESC",
   "type": "esriFieldTypeString",
   "alias": "WORK_DESC",
   "length": 111,
   "domain": null
  },
  {
   "name": "CONST_TYPE",
   "type": "esriFieldTypeString",
   "alias": "CONST_TYPE",
   "length": 13,
   "domain": null
  },
  {
   "name": "STRUCT_TYP",
   "type": "esriFieldTypeString",
   "alias": "STRUCT_TYP",
   "length": 12,
   "domain": null
  },
  {
   "name": "NO_UNITS",
   "type": "esriFieldTypeDouble",
   "alias": "NO_UNITS",
   "domain": null
  },
  {
   "name": "ADDRESS",
   "type": "esriFieldTypeString",
   "alias": "ADDRESS",
   "length": 37,
   "domain": null
  },
  {
   "name": "X_COORD",
   "type": "esriFieldTypeDouble",
   "alias": "X_COORD",
   "domain": null
  },
  {
   "name": "Y_COORD",
   "type": "esriFieldTypeDouble",
   "alias": "Y_COORD",
   "domain": null
  },
  {
   "name": "CODE",
   "type": "esriFieldTypeString",
   "alias": "CODE",
   "length": 13,
   "domain": null
  },
  {
   "name": "RuleID",
   "type": "esriFieldTypeInteger",
   "alias": "RuleID",
   "domain": null
  },
  {
   "name": "OwnerName",
   "type": "esriFieldTypeString",
   "alias": "OwnerName",
   "length": 50,
   "domain": null
  },
  {
   "name": "OBJECTID",
   "type": "esriFieldTypeOID",
   "alias": "OBJECTID",
   "domain": null
  },
  {
   "name": "Permit_Status",
   "type": "esriFieldTypeString",
   "alias": "Permit_Status",
   "length": 10,
   "domain": null
  }
 ],
 "relationships": [
  {
   "id": 0,
   "name": "for taslot",
   "relatedTableId": 2,
   "role": "esriRelRoleDestination",
   "keyField": "TLID",
   "cardinality": "esriRelCardinalityOneToMany",
   "composite": false
  },
  {
   "id": 1,
   "name": "owns TaxLots",
   "relatedTableId": 2,
   "role": "esriRelRoleDestination",
   "keyField": "OwnerName",
   "cardinality": "esriRelCardinalityOneToMany",
   "composite": false
  }
 ],
 "canModifyLayer": false,
 "canScaleSymbols": false,
 "hasLabels": false,
 "capabilities": "Map,Query,Data",
 "maxRecordCount": 1000,
 "supportsStatistics": true,
 "supportsAdvancedQueries": true,
 "supportedQueryFormats": "JSON, AMF",
 "isDataVersioned": true,
 "ownershipBasedAccessControlForFeatures": {"allowOthersToQuery": true},
 "useStandardizedQueries": true,
 "advancedQueryCapabilities": {
  "useStandardizedQueries": true,
  "supportsStatistics": true,
  "supportsOrderBy": true,
  "supportsDistinct": true,
  "supportsPagination": false,
  "supportsTrueCurve": true,
  "supportsReturningQueryExtent": true,
  "supportsQueryWithDistance": true
 },
 "dateFieldsTimeReference": null
}

JSON Response Syntax (when returnUpdates is true)

{
 "id": <layer id>,
 "timeExtent": [
  <start time>,
  <end time>
 ],
 "fullExtent": {
  "xmin": <xmin>,
  "ymin": <ymin>,
  "xmax": <xmax>,
  "ymax": <ymax>,
  "spatialReference": <spatialReference>
 }
}