Select to view content in your preferred language

Problem with Graphics Layer

1961
7
05-18-2012 01:17 PM
JaredWhite
Regular Contributor
Hi,
I'm having a problem my graphicslayers not displaying any query results, drawing functions work just fine. I believe it's something server side because i've copied and pasted sample query code from the api samples, tested and run perfectly with the default map services, then tested and failed with my own map services. My map service is dynamic and running on server 10.1, also it works perfectly in every other aspect. What could possibly be causing this problem?
0 Kudos
7 Replies
JaredWhite
Regular Contributor
also, all layers on the service support both query and generate renderer operations.
0 Kudos
JenniferNery
Esri Regular Contributor
In the ExecuteCompleted, do you get any Features in e.FeatureSet? If yes, did you have Query.ReturnGeometry = true and set Query.OutSpatialReference to your Map.SpatialReference? If yes, does your GraphicsLayer have Renderer defined and does the symbol match geometry (i.e. FillSymbol for Polygon, LineSymbol for Polyline, MarkerSymbol for MapPoint, etc)?
0 Kudos
JaredWhite
Regular Contributor
Yes to all of those things, I really believe this is server side, i just published another map service using the same data for a single layer from the problem map. renders just fine while if i throw too many of the layers together it doesn't render well at all. could the fact that the map service uses 12 layers be causing issues?
0 Kudos
JaredWhite
Regular Contributor
Somehow fixed it, I changed the symbology on map side of service and that did the trick for some reason. Not a good fix, but it's working now.
0 Kudos
JaredWhite
Regular Contributor
Ok, problem quickly returned, but atleast i have the debug telling me theres a problem now. I get this message in this location.
Keep in mind I'm using the eaxct same code from the samples gallery, except i'm using my service addresses instead of the default ones. If i remove the graphic renderer it runs just fine.
[ATTACH=CONFIG]14490[/ATTACH]
Any help would be greatly appreciated.
0 Kudos
JaredWhite
Regular Contributor
Solved
Changed code to
 private void FindDetails_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Highlight the graphic feature associated with the selected row
            DataGrid dataGrid = sender as DataGrid;
            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
            graphicsLayer.ClearGraphics();
            int selectedIndex = dataGrid.SelectedIndex;
            if (selectedIndex >= 0)
            {
                FindResult findResult = (FindResult)FindDetailsDataGrid.SelectedItem;
                Graphic graphic = findResult.Feature;
                {
                    graphic.Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as FillSymbol;
                    graphicsLayer.Graphics.Insert(0, graphic);
                }

                
                graphicsLayer.Graphics.Add(graphic);

              
            }
        }


from original sample code. Don't know why the other code didn't work, but this works just fine.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
                Graphic graphic = findResult.Feature;
                {
                    graphic.Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as FillSymbol;
                    graphicsLayer.Graphics.Insert(0, graphic);
                }

                
                graphicsLayer.Graphics.Add(graphic);


Side remark : you are inserting twice the same graphic, not that important, but...
0 Kudos