operationalLayer

Operational layers are the reason others are viewing your web map. Operational layers contain your business data. They are used to make thematic maps. Usually, a basemap sits beneath your operational layers to give them geographic context.

Operational layers can be ArcGIS map and image services, a single layer in an ArcGIS map or feature service, or other types of web services such as WMS or KML. An operational layer can reference a CSV file hosted on a web server. Alternatively, an operational layer can be a feature collection whose geometry and drawing information is stored directly in the web map.

Operational layers support pop-up windows so that others can click on a feature and learn more about it. Some types of operational layers can support editing through the web.

Operational layers are listed in an array. Layers are drawn in the order that they appear in the array. The first layer in the array is the first layer drawn, the next layer in the array is drawn on top of it, and so on.

Properties

Property

Details

capabilities

A comma-separated string listing which editing operations are allowed on an editable feature service. Available operations include: Create | Delete | Query | Update | Editing.

For example, the string "Create,Query" allows users to create and query features but not update or delete them.

By default, all operations already allowed by the service are enabled. You cannot use this property to allow operations that the service publisher or administrator has already forbidden on the service.

The Editing operation is for backward compatibility with ArcGIS 10.0, when only the Query and Editing operations were available.

columnDelimiter

A string defining the character used to separate columns in a CSV file. You can set this property using any of the following: ",", " ", ";", "|", "\t". Used with CSV layers only.

copyright

A string containing copyright and access information for a WMS layer. This is copied from the capabilities document exposed by the WMS.

extent

The rectangular map extent that should be requested from the service, given in the format [[xmin, ymin],[xmax,ymax]]. Used with WMS layers.

featureCollection

A featureCollection object defining a layer of features whose geometry and attributes will be stored directly within the web map. This is only used when no url property is supplied.

format

An optional string containing the image format to be requested from a WMS. The default is png, and this property only needs to be specified if a different image format will be requested, such as jpg.

id

A unique identifying string for the layer. You can additionally supply the itemId property if the layer comes from an item registered in ArcGIS Online or your organization's portal.

itemId

Optional string containing the item ID of the service if it's registered on ArcGIS Online or your organization's portal. The web map applies any styling and pop-up information contained in the saved item.

layerDefinition

A layerDefinition object defining the attribute schema and drawing information for the layer. Used with CSV layers.

layers

An array of layer objects, allowing overrides on pop-up content and drawing behavior for the individual layers of a map service. Used with map services.

locationInfo

A locationInfo object defining how location information will be retrieved from a CSV file. Used with CSV layers only.

mapUrl

For WMS layers, a string containing the URL of the WMS map. This property is not used with layer types other than WMS. When using a WMS operational layer, you should also supply the url property, which is the URL of the WMS capabilities document.

maxHeight

A number defining the maximum height, in pixels, that should be requested from the service. Used with WMS layers.

maxScale

A number representing the maximum scale at which the layer will be visible. The number is the scale's denominator; thus, a value of 2400 represents a scale of 1/2,400. A value of 0 indicates that the layer will be visible regardless of how far you zoom in.

maxWidth

A number defining the maximum width, in pixels, that should be requested from the service. Used with WMS layers.

minScale

A number representing the minimum scale at which the layer will be visible. The number is the scale's denominator; thus, a value of 2400 represents a scale of 1/2,400.

mode

Used with ArcGIS feature services and individual layers in ArcGIS map services, this property determines how the features are retrieved from the server. This property is represented as 0, 1, or 2.

  • 0—Snapshot mode. Immediately retrieves all features when the map is loaded.
  • 1—On-demand mode. Features within the current view extent are retrieved as the user navigates the map. This is the default and the most common way to use feature services in web maps.
  • 2—Selection-only mode. No features are initially retrieved. This mode is used when you have a map service and a feature service from the same parent URL that are working together in the same map, with the map service being used for display and the feature service used for editing.

opacity

The degree of transparency applied to the layer on the client side, where 0 is full transparency and 1 is no transparency.

popupInfo

A popupInfo object defining the content of pop-up windows when you click or query a feature.

spatialReferences

An array of numbers containing well-known IDs for spatial references supported by the service. Used with WMS layers.

title

A user-friendly string title for the layer that can be used in a table of contents. If this is not included, a title is derived from the service.

type

If the layer is referenced through a URL, but is not an ArcGIS web service, this parameter can be supplied to denote the layer type. Acceptable values include: CSV | WMS | KML.

url

The URL to the layer. The URL can reference any of the following:

  • An ArcGIS map service (hosted on ArcGIS Server or ArcGIS Online).
  • An ArcGIS image service.
  • A single layer in an ArcGIS map service. When using this option, features are retrieved through queries and displayed as client-side graphics.
  • A single layer in an ArcGIS feature service (hosted on ArcGIS Server or ArcGIS Online).
  • A capabilities document for a WMS service.
  • A KMZ file on a web server.
  • A CSV file on a web server.

If the layer is not from a web service but rather a feature collection, then the url property is omitted.

version

A string containing the version number of the service. Used with WMS layers.

visibility

Boolean property determining whether the layer is initially visible in the web map.

visibleLayers

An array of layers that should appear visible. Used with ArcGIS map services that are not tiled as well as WMS layers.

With ArcGIS map services, the array contains integers of the index positions of each visible layer. With WMS layers, the array contains the ID strings of the visible layers.

Examples

The properties you supply for an operational layer can vary depending on what type of layer it is. This section gives several examples.

ArcGIS Server map service as an operational layer

This example references an entire ArcGIS Server map service as an operational layer. If tiles are detected, they will be used; otherwise, the server will be asked to draw a dynamic image.

"operationalLayers": [{
    "url": "http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/MapServer",
    "id": "PoolPermits_5180",
    "visibility": true,
    "opacity": 1,
    "title": "PoolPermits"
  }]

ArcGIS Server feature service as an operational layer

This example shows how to reference an ArcGIS Server feature service as an operational layer. Only one layer at a time can be referenced; in this case, the roads layer at index position 3.

{
      "url": "http://servicesbeta.esri.com/arcgis/rest/services/Washington/CaribouPark/FeatureServer/3",
      "capabilities": "Query",
      "id": "CaribouPark_7668",
      "visibility": true,
      "opacity": 1,
      "mode": 1,
      "title": "CaribouPark - Roads",
      "popupInfo": { . . . }
    }

Feature collection as an operational layer

This layer holds features that are stored in the map as a feature collection. This is the kind of layer that you get in the ArcGIS Online map viewer if you drag and drop a CSV file onto the map, or if you create a map notes layer.

{
      "id": "mapNotes_2845",
      "title": "Oil Spill Location",
      "featureCollection": {"layers": [
        {
          . . .
        }],
      "visibility": true,
      "opacity": 1
    }

Item registered on ArcGIS Online as an operational layer

This example references an ArcGIS Server tiled map service that has been registered as an item on ArcGIS Online. The entire item is pulled into the web map using the itemId property. The styling and pop-up information stored in the ArcGIS Online item will be applied in the web map.

{
      "url": "http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Tapestry/MapServer",
      "id": "USA_Tapestry_8244",
      "visibility": true,
      "opacity": 1,
      "title": "USA Tapestry Segmentation",
      "itemId": "f5c23594330d431aa5d9a27abb90296d"
    }

Web-based CSV file as an operational layer

In this example, a CSV file is referenced through a URL. The CSV contains longitude and latitude coordinates, stored in fields named "x" and "y", respectively.

{
    "id": "csv_4442",
    "title": "fires",
    "visibility": true,
    "opacity": 1,
    "type": "CSV",
    "url": "http://myserver.esri.com/CSVs/fires.csv",
    "layerDefinition": {. . .},
    "popupInfo": {. . .},
    "locationInfo": {
      "locationType": "coordinates",
      "longitudeFieldName": "x",
      "latitudeFieldName": "y"   
    },
    "columnDelimiter": ","
  }
9/13/2017