Select to view content in your preferred language

Some MapService Layers Query results won't display as graphics layers

4290
15
Jump to solution
03-28-2012 04:15 AM
MattMiley
Deactivated User
I'm using the find example and when i query my storm map service everything works. WHen i query my water map services i get results in the datagrid but they won't show up as graphics layers when i select them.

Here is the returned Json for Storm (WORKING)

{   "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         }       }     }   ] }


Here is the returned Json for Water (NOT WORKING)

{   "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         }       }     }   ] }


Here is a storm layer attribute

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


Here is a water layer attributes, I think something is messed up here

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 


What do you think is the problem here?
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
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).

The test can be more generic:
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;

should work in both cases.

View solution in original post

0 Kudos
15 Replies
DominiqueBroux
Esri Frequent Contributor
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.

If you have no access to the service, the client workaround might to define your own renderer at the client side, for example a SimpleRenderer using the same symbol for all features.
0 Kudos
MattMiley
Deactivated User
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.


I'm pretty sure the service isn't hiding it, whenever I add it as a ArcGISDynamicMapServiceLayer it shows up just fine with all the published symbology.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
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


'Enabled' doesn't seem to be in the list of published fields.

ArcGISDynamicMapServiceLayer shows up fine because the rendering is done at the server side and doesn't need any published fields.
0 Kudos
MattMiley
Deactivated User
Sorry to be miss leading, but the post only allowed for 1000 characters in this forum so i had to remove some things. Here is what the hydrants page looks like.

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


This used to work with the water features before I made the symbols based on enabled. Therefore I thought that does have something to do with it. Then I did published the features again without any custom symbology and it didn't work still, so I'm just lost now.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
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.

Try to define a renderer at the client side to know if it's a rendering issue.

You could also look at the requests sent to the server with fiddler (or any HTTP sniffer), that might give a clue.
0 Kudos
MattMiley
Deactivated User
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



I have confirmed that its not the symbology, i published the water and storm again with default symbology and again storm worked and water didn't. I know the water is made up of a geomatic network and the storm is not. Can that have something to do with it?
0 Kudos
DominiqueBroux
Esri Frequent Contributor
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.
0 Kudos
MattMiley
Deactivated User
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.


Here is the query request
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&


Here is the response
{
  "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
        }
      }
    }
  ]
}
0 Kudos
MattMiley
Deactivated User
I do spatial queries on the features and it works fine.

Here is a spatial query working on water and adding graphics layers after i select an item in the listbox.
[ATTACH=CONFIG]13102[/ATTACH]

But when i do a find on the map service I get the results but no graphics are made once i select the item in the listbox.
[ATTACH=CONFIG]13103[/ATTACH]


Which sample would show me the easiest way to define a renderer at the client side to know if it's a rendering issue?
0 Kudos