{ "results" : [ { "layerId" : 0, "layerName" : "GIS.GISADMIN.StormNodes", "displayFieldName" : "NodeType", "foundFieldName" : "OBJECTID", "value" : "11", "attributes" : { "OBJECTID" : "11", "Element_ID" : "0", "SOURCE_DES" : "Sanitary Sewer Improvements Contract 10-S", "Coordinate" : "648444.115, 2060333.176", "Shape" : "Point" }, "geometryType" : "esriGeometryPoint", "geometry" : { "x" : -9146569.69071188, "y" : 5078354.76733345, "spatialReference" : { "wkid" : 102100 } } }, { "layerId" : 2, "layerName" : "GIS.GISADMIN.OutFalls", "displayFieldName" : "StreamName", "foundFieldName" : "OBJECTID", "value" : "11", "attributes" : { "OBJECTID" : "11", "StreamName" : "Black River", "OutFallName" : "Tacoma", "Shape" : "Point", "Type" : "Outfall", "Name" : "Null", "Notes" : "Null", "Notes_1" : "Null", "Oberservation_Date" : "Null", "Oberserver" : "Null" }, "geometryType" : "esriGeometryPoint", "geometry" : { "x" : -9140394.26845358, "y" : 5078269.86245744, "spatialReference" : { "wkid" : 102100 } } } ] }
{ "results" : [ { "layerId" : 0, "layerName" : "Hydrants", "displayFieldName" : "HYDRANTNUMBER", "foundFieldName" : "OBJECTID", "value" : "11", "attributes" : { "OBJECTID" : "11", "HydrantNumber" : "H0561", "Location" : "S.W. CORNER OF BROWNELL AVE.AND WEST ERIE AVE", "Hyd_Num" : "Null" }, "geometryType" : "esriGeometryPoint", "geometry" : { "x" : -9149034.62292915, "y" : 5081286.44737778, "spatialReference" : { "wkid" : 102100 } } }, { "layerId" : 1, "layerName" : "Valves", "displayFieldName" : "VALVENUMBER", "foundFieldName" : "OBJECTID", "value" : "11", "attributes" : { "OBJECTID" : "11", "ValveNumber" : "V4016", "Valve_Diameter" : "8" }, "geometryType" : "esriGeometryPoint", "geometry" : { "x" : -9153324.01843533, "y" : 5077188.05044879, "spatialReference" : { "wkid" : 102100 } } }, { "layerId" : 2, "layerName" : "LateralNodes", "displayFieldName" : "ENABLED", "foundFieldName" : "OBJECTID", "value" : "11", "attributes" : { "OBJECTID" : "11", "Enabled" : "True", "SHAPE" : "Point" }, "geometryType" : "esriGeometryPoint", "geometry" : { "x" : -9159684.58115913, "y" : 5072989.92068145, "spatialReference" : { "wkid" : 102100 } } } ] }
Layer: GIS.GISADMIN.StormNodes (ID: 0) Display Field: NodeType Type: Feature Layer Geometry Type: esriGeometryPoint Description: Definition Expression: Copyright Text: Min. Scale: 10000 Max. Scale: 0 Default Visibility: True Extent: XMin: 2051575.44395877 YMin: 644699.275933608 XMax: 2071690.73607719 YMax: 657055.237114027 Spatial Reference: 3734 Has Attachments: False HTML Popup Type: esriServerHTMLPopupTypeAsHTMLText Drawing Info: Renderer: Unique Value Renderer: Field 1: NodeType Field 2: Field 3: Field Delimiter: , Default Symbol: Unsupported Symbol Default Label: Unique Value Infos: Value: Gutter Inlet Label: Gutter Inlet Description: Symbol: Picture Marker Symbol: Value: Inlet Basin Label: Inlet Basin Description: Symbol: Picture Marker Symbol: Value: Manhole Label: Manhole Description: Symbol: Picture Marker Symbol: Transparency: 0 Labeling Info: N/A Fields: OBJECTID (Type: esriFieldTypeOID, Alias: OBJECTID) Element_ID (Type: esriFieldTypeDouble, Alias: Element_ID) NodeType (Type: esriFieldTypeString, Alias: NodeType, Length: 32 ) NodeNumber (Type: esriFieldTypeString, Alias: NodeNumber, Length: 32 ) Coordinate (Type: esriFieldTypeString, Alias: Coordinate, Length: 30 ) Shape (Type: esriFieldTypeGeometry, Alias: Shape) Type ID Field: N/A Supported Interfaces: REST Supported Operations: Query
Layer: Hydrants (ID: 0) Display Field: HYDRANTNUMBER Type: Feature Layer Geometry Type: esriGeometryPoint Description: Definition Expression: Copyright Text: Min. Scale: 10000 Max. Scale: 0 Default Visibility: True Extent: XMin: 2028056.97998909 YMin: 628506.51000617 XMax: 2077442.1400012 YMax: 662339.880002109 Spatial Reference: 3734 Has Attachments: False HTML Popup Type: esriServerHTMLPopupTypeNone Drawing Info: Renderer: Unique Value Renderer: Field 1: Enabled Field 2: Field 3: Field Delimiter: , Default Symbol: Unsupported Symbol Default Label: Unique Value Infos: Value: 0 Label: False Description: Symbol: Picture Marker Symbol: Value: 1 Label: True Description: Symbol: Picture Marker Symbol: Transparency: 0 Labeling Info: Label Placement: esriServerPointLabelPlacementBelowCenter Label Expression: [HYDRANTNUMBER] Use Coded Values: True Symbol: Simple Text Symbol: Type: esriTS Color:255, 0, 0, 255 Background Color: null Border Line Color: null Vertical Alignment: bottom Horizontal Alignment: center Right To Left: False Angle: 0 XOffset: 0 YOffset: 0 Font Family: Arial Font Size: 8 Font Style: normal Font Weight: bold Font Decoration: none Min. Scale: 0 Max. Scale: 0 Fields: OBJECTID (Type: esriFieldTypeOID, Alias: OBJECTID) HydrantNumber (Type: esriFieldTypeString, Alias: HydrantNumber, Length: 16 ) YearInstalled (Type: esriFieldTypeInteger, Alias: YearInstalled) Manufacturer (Type: esriFieldTypeString, Alias: Manufacturer, Length: 32 ) Hyd_Num (Type: esriFieldTypeInteger, Alias: Hyd_Num) Type ID Field: N/A Supported Interfaces: REST Supported Operations: Query
Solved! Go to Solution.
<esri:GraphicsLayer> <esri:GraphicsLayer.Renderer> <esri:SimpleRenderer> <esri:SimpleRenderer.Symbol><esri:SimpleMarkerSymbol Color="#99FF0000"/></esri:SimpleRenderer.Symbol> </esri:SimpleRenderer> </esri:GraphicsLayer.Renderer> </esri:GraphicsLayer>
switch (graphic.Attributes["Shape"].ToString()) .....
if (graphic.Geometry is Polygon) graphic.Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; else if (graphic.Geometry is Polyline) graphic.Symbol = LayoutRoot.Resources["DefaultLineSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; else if (graphic.Geometry is MapPoint) graphic.Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
I think I found out the issue.
It's because your shape field is called SHAPE (uppercase) and the Find sample is looking for an attribute called "Shape".switch (graphic.Attributes["Shape"].ToString()) .....
If you replace "SHAPE" by "Shape" that will work for your second service (but no more for the first one).
void QueryTaskArkPow_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args4) { FeatureSet featureSet4 = args4.FeatureSet; if (featureSet4 != null && featureSet4.Features.Count > 0) { Query2DetailsDataGrid.ItemsSource = featureSet4.Features; featureSet4.SpatialReference = Map.SpatialReference; PowiatyButtonClear.IsEnabled = true; GraphicsLayer arkgmin = Map.Layers["ArkuszeLayer"] as GraphicsLayer; foreach (Graphic arkusz in featureSet4.Features) { arkusz.Symbol = SelectedFeatureSymbol; arkgmin.Graphics.Add(arkusz); } } else MessageBox.Show("No features returned from query"); }
- is the geometry of the returned graphics OK?
- does your SelectedFeatureSymbol match the geometry type (point, line, polygon) of your graphics?
<Grid.Resources> <esriSymbols:SimpleMarkerSymbol x:Name="IdentifyLocationSymbol" Color="Blue" Size="5" /> <esri:SimpleFillSymbol x:Name="SelectedFeatureSymbol" Fill="#64FF0000" BorderBrush="Red" BorderThickness="2" /> <esri:SimpleFillSymbol x:Name="FindFillSymbol" Fill="#500000FF" BorderBrush="Blue" BorderThickness="1" /> </Grid.Resources>