Adding shape files as feature layers

1765
2
Jump to solution
01-15-2013 05:08 AM
Labels (1)
GeorgeFaraj
Occasional Contributor III
I'm using the following sample to add shape files to my map:
http://www.arcgis.com/home/item.html?id=953a530ada30477d95cc69e788268bc9

This adds the layer as an ArcGISLocalDynamicMapServiceLayer. I want to add it as a Feature Layer, so that I can select and label features. I haven't been able to do this. Is this possible?

Thanks,
George
0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor
Hi,

Actually it is possible to create a FeatureLayer from a MapServer endpoint, with the DynamicLayer capability enabled and have it honour the per-request service definition so this may allow you to achieve your objective. The code below is taken from the "Dynamic Layers Thematic Mapping" sample  - see the new online sample pages (http://resources.arcgis.com/en/help/runtime-wpf/samples/index.html#/Dynamic_Layers_Thematic_Online/0...) or also available in your locally installed sample app under "Mapping" > "Dynamic Map Layers"... this code shows creating a FeatureLayer from a MapServer endpoint with the "/dynamicLayer" suffix and setting the ID of the layer within the map service which this layer will represent (LayerMapSource).

            <esri:FeatureLayer ID="StatesFeatureLayer" OutFields="*" DisplayName="USA Census - States"                     Url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/dynamicLayer"                                 Initialized="FeatureLayer_Initialized">                 <esri:FeatureLayer.Source>                     <esri:LayerMapSource MapLayerID="3"/>                 </esri:FeatureLayer.Source>             </esri:FeatureLayer>


In the case above, it uses an existing layer within the service but you may be able work with a table data source (see http://resources.arcgis.com/en/help/runtime-wpf/samples/index.html#/Dynamic_Layers_in_XAML_Online/02...) - unfortunately I haven't been able to try this.

                               <esri:LayerDataSource>                                     <esri:LayerDataSource.DataSource>                                         <esri:TableDataSource                                              WorkspaceID="MyDatabaseWorkspaceIDSSR2"                                              DataSourceName="ss6.gdb.Lakes" />                                     </esri:LayerDataSource.DataSource>                                 </esri:LayerDataSource>


It's worth noting that the FeatureServer endpoint does not support the DynamicLayer capability and therefore it's not possible to perform operations against the FeatureServer (e.g. updating features) that honour the per-request modification of the service.


Cheers

Mike

View solution in original post

0 Kudos
2 Replies
GeorgeFaraj
Occasional Contributor III
Is it safe to assume this can't be done?
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

Actually it is possible to create a FeatureLayer from a MapServer endpoint, with the DynamicLayer capability enabled and have it honour the per-request service definition so this may allow you to achieve your objective. The code below is taken from the "Dynamic Layers Thematic Mapping" sample  - see the new online sample pages (http://resources.arcgis.com/en/help/runtime-wpf/samples/index.html#/Dynamic_Layers_Thematic_Online/0...) or also available in your locally installed sample app under "Mapping" > "Dynamic Map Layers"... this code shows creating a FeatureLayer from a MapServer endpoint with the "/dynamicLayer" suffix and setting the ID of the layer within the map service which this layer will represent (LayerMapSource).

            <esri:FeatureLayer ID="StatesFeatureLayer" OutFields="*" DisplayName="USA Census - States"                     Url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/dynamicLayer"                                 Initialized="FeatureLayer_Initialized">                 <esri:FeatureLayer.Source>                     <esri:LayerMapSource MapLayerID="3"/>                 </esri:FeatureLayer.Source>             </esri:FeatureLayer>


In the case above, it uses an existing layer within the service but you may be able work with a table data source (see http://resources.arcgis.com/en/help/runtime-wpf/samples/index.html#/Dynamic_Layers_in_XAML_Online/02...) - unfortunately I haven't been able to try this.

                               <esri:LayerDataSource>                                     <esri:LayerDataSource.DataSource>                                         <esri:TableDataSource                                              WorkspaceID="MyDatabaseWorkspaceIDSSR2"                                              DataSourceName="ss6.gdb.Lakes" />                                     </esri:LayerDataSource.DataSource>                                 </esri:LayerDataSource>


It's worth noting that the FeatureServer endpoint does not support the DynamicLayer capability and therefore it's not possible to perform operations against the FeatureServer (e.g. updating features) that honour the per-request modification of the service.


Cheers

Mike
0 Kudos