{ "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.
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;
In your non working case, it looks like the field used for the rendering (i.e. 'Enabled') is not published by the service.
Check that your service is not hiding that field.
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
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 ) Model (Type: esriFieldTypeString, Alias: Model, Length: 32 ) Ownership (Type: esriFieldTypeString, Alias: Ownership, Length: 32 ) DrawingSet_ID (Type: esriFieldTypeInteger, Alias: DrawingSet_ID) DrawingSheet (Type: esriFieldTypeString, Alias: DrawingSheet, Length: 8 ) SHAPE (Type: esriFieldTypeGeometry, Alias: SHAPE) Enabled (Type: esriFieldTypeSmallInteger, Alias: Enabled, Domain: Coded Values: [0: False], [1: True] ) SOURCE_DESCRIPTION (Type: esriFieldTypeString, Alias: SOURCE_DESCRIPTION, Length: 64 ) FOLDER (Type: esriFieldTypeString, Alias: FOLDER, Length: 128 ) Location (Type: esriFieldTypeString, Alias: Location, Length: 255 ) Hyd_Num (Type: esriFieldTypeInteger, Alias: Hyd_Num) Type ID Field: N/A Supported Interfaces: REST Supported Operations: Query
Sorry to be miss leading, but the post only allowed for 1000 characters in this forum so i had to remove some things.
OK looks good.
You could also look at the requests sent to the server with fiddler (or any HTTP sniffer), that might give a clue.
contains true f json layers 0,1,2,3 returnGeometry true searchFields OBJECTID searchText 111 sr 102100 Cache-Control private Content-Encoding gzip Content-Length 895 Content-Type text/plain;charset=utf-8 Date Thu, 29 Mar 2012 13:53:03 GMT Etag -204973084 Server Microsoft-IIS/7.5 X-Powered-By ASP.NET Request Headersview source Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding gzip, deflate Accept-Language en-us,en;q=0.5 Connection keep-alive Host XXXXXXXX User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2
Content-Length 895
Looks small for features (just enough to define your 14 fields).
Are you sure some features are returned from the server? Might be a query issue.
http://XXXXXX/ArcGIS/rest/services/Water_Utilities_Map/MapServer/find?searchText=5400&contains=true&returnGeometry=true&sr=102100&searchFields=HydrantNumber%2cValveNumber%2cMeter_Number%2cLateral_Number%2cPipe_Number&layers=0%2c1%2c2%2c3%2c4%2c5%2c6%2c7%2c8&f=pjson&
{ "results" : [ { "layerId" : 1, "layerName" : "Valves", "displayFieldName" : "VALVENUMBER", "foundFieldName" : "ValveNumber", "value" : "V5400n", "attributes" : { "OBJECTID" : "4116", "ValveNumber" : "V5400n", "ValveType" : "Null", "YearInstalled" : "Null", "Manufacturer" : "Null", "Model" : "Null", "Ownership" : "Lorain", "DrawingSet_ID" : "2", "DwgSheet" : "1", "StartNode_ID" : "Null", "SHAPE" : "Point", "Enabled" : "True", "SOURCE_DESCRIPTION" : "Null", "FOLDER" : "Null", "Location" : "Null", "Turns" : "Null", "DirectionOpen" : "Null", "Valve_Diameter" : "Null" }, "geometryType" : "esriGeometryPoint", "geometry" : { "x" : -9148438.16978488, "y" : 5081889.88472851, "spatialReference" : { "wkid" : 102100 } } } ] }