Layer tag

This page describes an older version, please read about the latest version at:
http://resources.arcgis.com/en/help/flex-viewer/concepts/

Data content in the ArcGIS Viewer for Flex application ("the Viewer") is defined by layers. A layer references a web service being accessed by the Viewer. The Viewer supports many different layer data sources, such as cached or dynamic map services, and Bing Maps. It can display layers as either basemaps or operational layers. See the following illustration of map layers:

Layers are the content of the map

The <layer> tag is a map service displayed as a layer in the Viewer. It must be enclosed within a <basemaps> or <operationallayers> tag, which is enclosed within a <map> tag. See the Main configuration file topic for more details on using layers in the Viewer.

The <layer> tag has the following attributes:

Child tag specific to layers of types dynamic and tiles

<sublayer> supports the following attributes:

  • id—The ID, usually a number, of the sublayer within the map service.
  • popupconfig—URL to the .xml configuration file of the pop-up window. See Pop-up configuration files for more information. [Added in version 2.3]
  • definitionexpression—Limits the data to a subset of the available features in the map service layer. It's similar to the definition query for a layer in ArcMap.

Child tag specific to layers of type feature

<clustering> supports one child tag and two attributes. [Added in version 2.4]

<clustering> tag attributes
  • mingraphiccount—Minimum number of graphics to display in a cluster, before rendering the cluster using the clusterer symbol.
  • sizeinpixels—Cluster size in pixels. Default value is 70 pixels.
Child tag for the <clustering> tag
<clustersymbol>
The <clustersymbol> tags have the following attributes:
  • type—In version 2.4, the only supported value is "simple".
  • alpha—The alpha transparency of the cluster symbol. Default is 0.75.
  • color—Color of the cluster symbol. Default is 0x76D100 (turtle green).
  • size—Size of the cluster symbol. Default is 70.
  • textcolor—Color of the text within the cluster symbol. Default is black.
  • alphas—The different alphas to use for classes within the matching weights. Only applicable when weights have been set. The transparency will default to alpha for class breaks not specified in this attribute.
  • colors—The different colors to use for classes within the matching weights. Only applicable when weights have been set. The color will default to color for class breaks not specified in this attribute.
  • sizes—The different sizes to use for classes within the matching weights. Only applicable when weights have been set. The symbol size will default to size for class breaks not specified in this attribute.
  • weights—The different class breaks, for example weights="50,100", will create two classes: one with feature counts between 1 and 50, and another for 51–100 features. Use together with the alphas, colors, and sizes attributes to create symbology based on the feature count. Clusters that don't fall into these class breaks will use the symbology specified by the alpha, color, and size attributes.

NoteNote:

The following clustering example creates three categories of different sized cluster symbols based on the feature count for each cluster. The class breaks are defined using the weights attribute. To set up three classes—one for 1–10 features, another for 11–100 features, and a third for 101–9,999 features—use weights="10,100,9999". If there are any clusters with more than 9,999 features, they would use the defaults (as specified above) or any alpha, color, or size attribute defined.

  • Clusters with 1–10 features: size will be 30, color 0xFFFF00 (yellow).
  • Clusters with 11–100 features: size will be 60, color 0xFFA500 (orange).
  • Clusters with 101–9,999 features: size will be 90, color 0xFF0000 (red).

<layer label="San Francisco 311"
           type="feature"
           url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/MapServer/0"
           popupconfig="popups/PopUp_311.xml"
           visible="true">
        <clustering mingraphiccount="2" sizeinpixels="80">
            <clustersymbol type="simple"
                colors="0xFFFF00,0xFF5000,0xFF0000"
                sizes="30,60,90"
                textsize="14"
                weights="10,100,9999" />
        </clustering>
</layer>

Attributes specific to layers of type feature

  • popupconfig—URL to the xml configuration file of the pop-up window. Works with layers of type dynamic, tiled, and feature. [Added in version 2.3]
  • mode—The caching mode to use. Valid values are onDemand and snapshot.
  • definitionexpression—Limits the data to a subset of the available features in the map service layer. It is similar to the definition query for a layer in ArcMap.
  • useamf—The message format between client and server (to use AMF instead of JSON). It's not required but allows you to overwrite the default. On the server side, ArcGIS 10 supports AMF, but ArcGIS 9.3 does not.
  • info—URL to the info widget.
    TipTip:

    As of version 2.3 we recommend using popupconfig instead of info & infoconfig.

  • infoconfig—URL to the xml configuration file for the info widget.
    TipTip:

    As of version 2.3 we recommend using popupconfig instead of info & infoconfig.

Attributes specific to layers of type image

  • bandids—Comma-separated list of the band IDs to use for a specific image service (optional). [Added in version 2.3]

Attributes specific to Bing Maps

  • style—Valid values are road (default), aerial, or aerialWithLabels.
  • culture—Language to use for the labels on Bing Maps' road or aerialWithLabels styles (for example, en-US or sv-SE). See the Microsoft Bing Maps REST documentation for the list of supported cultures.

NoteNote:

Bing Maps require a Bing key for maps and geocoding. See <bing key="your-bing-key"/> in the main configuration file for information on how to add a Bing key, and the Flex API documentation for information on how to get a Bing key.

Attributes specific to ArcIMS

  • servicehost —URL of the ArcIMS server.
  • servicename—Name of the ArcIMS service.

Attributes specific to WMS

NoteNote:

The WMS service does not specify which layers should be visible by default, so make sure to use the visiblelayers attribute (listed above) or no sublayers will be shown.

  • skipgetcapabilities—Gives the option to skip the initial request to get capabilities. Set skipgetcapabilities to true if the site hosting the WMS service does not provide a cross domain policy file and you do not have a proxy page (optional).
  • version—Version to use when requesting WMS maps. Allowed values are 1.1.0, 1.1.1, or 1.3.0. (optional).
  • wkid—Overwrites the WKID sent to the WMS server. Only needed if the WMS server doesn't recognize your map's wkid. [Added in version 2.3.1]

Attribute specific to KML

NoteNote:

The KML needs to be a publicly accessible KML file (*.kml, *.kmz).

  • serviceurl—Optional, URL to your own utility service for converting KML files to features. [Added in version 2.5]

Code sample

The config.xml file code sample is as follows:

<layer label="Streets"
    type="tiled"
    visible="true"
    url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
...

Troubleshooting

2/15/2012