Skip To Content

FeatureLayer from dynamic workspace

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx=""
               pageTitle="Dynamic layer - FeatureLayer">
    This sample demonstrates how to create a FeatureLayer using a
    dynamic layer (lakes) from a service that has a registered workspace.
    This demonstrates one of the new features in ArcGIS 10.1; adding layers
    on the fly through a dynamic workspace, which allows
    developers to add layers on the fly that do not exist in a service.
    The ArcGIS map service needs to have the Dynamic Layers capability turned on,
    and it also needs a registered workspace.  The registered workspace will be of
    type (Database, File Geodatabase, Shapefile, or Raster), and once registered then
    you can access layers within the workspace.

    This sample adds the layer as a client-side FeatureLayer, whereas the
    "Dynamic Workspace" sample uses the server-side method to add the layer
    to the map service.  This sample uses client-side methods to symbolize
    the features, whereas the other sample uses server-side methods to add
    the layer and symbolize the features on the server.

    For more information, see the API documentation.

    ArcGIS REST API documentation:

    ArcGIS for Server documentation:

        @namespace esri "";

            headerBackgroundColor: #0080FF;

            import com.esri.ags.utils.JSONUtil;

        <!-- Place non-visual elements (e.g., services, value objects) here -->
        <!-- Lakes Layer Dynamic Layer Info -->
        <esri:LayerDataSource id="lakesLayerDataSource">
            <!-- FeatureClass within the Dynamic Workspace (follow the link in the sample description for more information on dynamic workspaces) -->
            <esri:TableDataSource dataSourceName="ss6.gdb.Lakes" workspaceId="MyDatabaseWorkspaceIDSSR2"/>

        <s:RichEditableText width="100%" editable="false">
            This sample demonstrates how to create a FeatureLayer using a
            dynamic layer (lakes) from a service that has a registered workspace.
            The lakes layer currently does not exist in the <s:a href="">map service</s:a>, but are in the dynamic workspace.
            Click on a lake to see more information, or <s:a href="{JSONUtil.encode({ source: lakesLayerDataSource })}" target="_blank">view the dynamic layer (lakes)</s:a>.

    <esri:Map infoWindowRendererHighlightColor="0x0080FF">
            <esri:Extent xmin="-10344842" ymin="4505780" xmax="-8566611" ymax="6408757">
                <esri:SpatialReference wkid="102100"/>
        <esri:ArcGISTiledMapServiceLayer url=""/>
        <esri:FeatureLayer id="lakesLayer"
                    <esri:LabelDataRenderer label="Lake Details">
                        <s:VGroup paddingBottom="5"
                            <s:Label text="ID: { data.objectid }"/>
                            <s:Label text="Name: { }"/>
                    <esri:SimpleFillSymbol color="0x0080FF">
                        <esri:SimpleLineSymbol color="0x004080" style="solid"/>