Is there a simpler way to create a layer from selected features?
From the research I have done I would:
Get the selected feature-->create a list/array of OBJECTIDs-->Copy the layer containing the selected features --> apply a definition query based on the list of OBJECTIDs-->…
This is obviously an abbreviated description, but I do not see a simpler approach.
Hi Brad,
You could also add a definition to a feature layer using BasicFeatureLayer.SetDefinitionQuery.
You can see a sample with this method: QueryBuilderControl
Thanks
Uma
Uma, I used CreateFeatureLayer then the SetDefinitionQuery method on the layer.
var slectionLayer = LayerFactory.Instance.CreateFeatureLayer(uri, mapView, 0, "Selection Layer") selectionLayer.SetDefinitionQuery(defQuery);
I noticed that the CreateFeatureLayer method has the optional parameter RendererDefinition. I couldn't find any documentation or examples on how to use this parameter to set a simple single symbol renderer. I found plenty for graduated and unique colour symbol examples.
This isn't a big deal. I just used the CIMSimpleRenderer class to create a renderer then SetRenderer after the layer has loaded.
Just curious how this would work since I initially wanted the layer load with the renderer set.
Thanks.