Select to view content in your preferred language

Hopefully another simple question!

2034
1
01-27-2011 09:08 AM
DavidAshton
Frequent Contributor
I have a graphic layer that loads on startup of a application (points).  This graphic layers some maptips associated with it.  Basically I have a lot of points loading like 5000 but only a few load maybe 500.  Is there a setting to restrict the amount of graphics to load?

thanks

here's my c# code behind
  void MyMap_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "SpatialReference")
            {
                LocsGraphicsLayerLoad();
                Map.PropertyChanged -= MyMap_PropertyChanged;
            }
        }

        void LocsGraphicsLayerLoad()
        {
            ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query()
            {
                Geometry = new ESRI.ArcGIS.Client.Geometry.Envelope(-180, 0, 0, 90),
                OutSpatialReference = Map.SpatialReference
            };
            query.OutFields.Add("*");

           
            // Return geometry with result features
            query.ReturnGeometry = true;
            
            QueryTask queryTask = new QueryTask("http://machineserver1/ArcGIS/rest/services/Graphics/MapServer/1");
            queryTask.ExecuteCompleted += LocsGraphicsLayerQueryTask_ExecuteCompleted;
            queryTask.ExecuteAsync(query);
        }

        void LocsGraphicsLayerQueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs queryArgs)
        {
            if (queryArgs.FeatureSet == null)
                return;

            FeatureSet resultFeatureSet = queryArgs.FeatureSet;
            ESRI.ArcGIS.Client.GraphicsLayer graphicsLayer =
            Map.Layers["LocsGraphicsLayer"] as ESRI.ArcGIS.Client.GraphicsLayer;

            if (resultFeatureSet != null && resultFeatureSet.Features.Count > 0)
            {
                foreach (ESRI.ArcGIS.Client.Graphic graphicFeature in resultFeatureSet.Features)
                {
                    graphicFeature.Symbol = LayoutRoot.Resources["MapTipMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
                    graphicsLayer.Graphics.Add(graphicFeature);
                }
            }
        }



And then in my xaml I have


<esri:GraphicsLayer ID="LocsGraphicsLayer">
                            <esri:GraphicsLayer.MapTip>
                                <Border BorderBrush="DarkGray" CornerRadius="13" BorderThickness="1" Margin="0,0,15,15">
                                    <Border.Effect>
                                        <DropShadowEffect ShadowDepth="10" BlurRadius="14" Direction="300" />
                                    </Border.Effect>
                                    <Border CornerRadius="10" Background="#DDFFEEEE" BorderThickness="5" BorderBrush="#77FF0000">
                                        <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="10">
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Text="TYPE: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center"/>
                                                <TextBlock Text="{Binding [STRUCTURENAME]}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Text="OBJECT ID: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center" />
                                                <TextBlock Text="{Binding [FEATUREID]}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Text="PRIORITY: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center" />
                                                <TextBlock Text="{Binding [RANK]}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Text="LONG ID: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center"/>
                                                <TextBlock Text="{Binding [STRUCTUREID]}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                            </StackPanel>
                                        </StackPanel>
                                    </Border>
                                </Border>
                            </esri:GraphicsLayer.MapTip>
                        </esri:GraphicsLayer>
0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor
ArcGIS Server v9.x only returns a maximum of 500 features at a time, v10 the limit is 1000.
You can do multiple queries if you need (ie set a where clause where ObjectID>XXX where XXX what the largest value from previous response), or you can configure your rest server to return more results (not recommended).

However, if you need to load that much data you should seriously reconsider your approach. Its a lot of load to put on the users network, your server, and for rendering on the client. You will likely see poor performance in all 3 areas. Instead rethink your idea, and try only to load data that the user really needs (no one needs to interact with 5000 features). Combine it with a dynamic layer for rendering large amounts of data as well. You can use the featurelayers OnDemand mode to only load features that are in the current view, and only enable the layer when zoomed in beyond a specific scale range (use Layer.MaximumResolution setting for that). At that zoomlevel turn off the dynamic layer, so the featurelayer takes over on higher resolutions.
0 Kudos