If your query results are added to a new graphics layer the default settings for layer will apply. Meaning all fields as defined by your service will be added, be visible and have alias names as defined by the service.
// Retrieve or create a graphics layer to use for displaying results GraphicsLayer graphicsLayer = null; if (featureSet.Features[0].Geometry is ESRI.ArcGIS.Client.Geometry.MapPoint) graphicsLayer = GetOrCreateLayer("Policy Spatial Query Results", "CustomStrobeMarkerSymbol"); else if (featureSet.Features[0].Geometry is ESRI.ArcGIS.Client.Geometry.Polyline) graphicsLayer = GetOrCreateLayer("Polyline Spatial Query Results", "RedLineSymbol"); else if (featureSet.Features[0].Geometry is ESRI.ArcGIS.Client.Geometry.Polygon) graphicsLayer = GetOrCreateLayer("Polygon Spatial Query Results", "RedFillSymbol"); string RecCount = featureSet.Features.Count.ToString(); string strRecordLimit = null; // Add results to the graphics layer graphicsLayer.ClearGraphics(); //clear out any old features foreach (Graphic feature in featureSet.Features) graphicsLayer.Graphics.Add(feature); // Add the results graphics layer to the map if it has not already been added and the results to map checkbox is checked if (chkResults2Map.IsChecked == true) { if (MapApplication.Current.Map.Layers[graphicsLayer.ID] == null) MapApplication.Current.Map.Layers.Add(graphicsLayer); } } private GraphicsLayer GetOrCreateLayer(string layerId, string renderer) { Layer layer = MapApplication.Current.Map.Layers[layerId]; if (layer != null && layer is GraphicsLayer) { return layer as GraphicsLayer; } else { GraphicsLayer gLayer = new GraphicsLayer() { ID = layerId, Renderer = new SimpleRenderer() { Symbol = Resources[renderer] as Symbol } }; gLayer.SetValue(MapApplication.LayerNameProperty, layerId); return gLayer; } }
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.