using UseAcceleratedDisplay is throwing exception

903
10
Jump to solution
09-05-2012 08:19 AM
Labels (1)
GhassanKarwchan
New Contributor III
I have a layer with 7000 features, so I am increasing maxRecords of the map service, and I am adding the attribute UseAcceleratedDisplay to be true for the map
and it is failing, and throwing exception SEHException



and when I don't use UseAcceleratedDisplay , it works but it is so slow
If I don't use it, the layer will take 15-25 seconds to load

And I am using very simple fill symbol,
<esri:SimpleRenderer x:Key="MySimpleRenderer">
                <esri:SimpleRenderer.Symbol>
                    <esri:SimpleFillSymbol BorderBrush="Blue" BorderThickness="4"/>
                </esri:SimpleRenderer.Symbol>
            </esri:SimpleRenderer>

I appreciate your help, because I am converting an application from ArcGIS engine, and for two days, I couldn't display a layer.
Was this product tested before release?
0 Kudos
1 Solution

Accepted Solutions
AnttiKajanus1
Occasional Contributor III
Btw, I think you might want to think solution a bit differently (depending offcourse what your goal is).

Since you are showing so much data, might be better way to use feature layer and dynamic layer combination to achieve the target. Ie. showing all possible data in dynamic layer and by click on the feature transfer it to the feature layer and do the needed magic there.

View solution in original post

0 Kudos
10 Replies
GhassanKarwchan
New Contributor III
I uploaded the data I am using
http://gisspan.com/Resources/Resources.zip
So, Can someone help me please
0 Kudos
AnttiKajanus1
Occasional Contributor III
Hi there,

I tested your package and got the same issue. If I used 1000 as a max records, it works fine but with 7000 i get issues.

<Grid>  
        <esri:Map x:Name="_map" UseAcceleratedDisplay="True" >
            <!-- ArcGIS Online Tiled Basemap Layer -->
            <esri:ArcGISTiledMapServiceLayer ID="World Topo Map" 
                       Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>


            <!--Local Feature Layer-->
            <esri:ArcGISLocalFeatureLayer ID="arcGISLocalFeatureLayer" 
                      Path="M:\ArcGIS\Databases\SOPFIM_Full.mpk" UpdateCompleted="ArcGISLocalFeatureLayer_UpdateCompleted"
                      LayerName="ContourQC">
            </esri:ArcGISLocalFeatureLayer>
        </esri:Map>
        <StackPanel>
            <TextBlock x:Name="txtBlock" VerticalAlignment="Top" HorizontalAlignment="Left"></TextBlock>
            <TextBlock x:Name="countBlock" VerticalAlignment="Top" HorizontalAlignment="Left"></TextBlock>
        </StackPanel>
    </Grid>


   public MainWindow()
        {
            var localFeatureService = new LocalFeatureService()
            {
                MaxRecords = 10000,
                Path = @"M:\ArcGIS\Databases\SOPFIM_Full.mpk",
            };
            localFeatureService.Start();


            InitializeComponent();
        }


        private void ArcGISLocalFeatureLayer_UpdateCompleted(object sender, System.EventArgs e)
        {
            var layer = (sender as ArcGISLocalFeatureLayer);
            this.txtBlock.Text = layer.ExceededTransferLimit.ToString();
            this.countBlock.Text = layer.Graphics.Count.ToString();
        }
0 Kudos
AnttiKajanus1
Occasional Contributor III
It seems that the limit goes around 3000-3500 and after that is starts to break. With value 3000 it seems to work fine.

Attached log file.
0 Kudos
AnttiKajanus1
Occasional Contributor III
Btw, I think you might want to think solution a bit differently (depending offcourse what your goal is).

Since you are showing so much data, might be better way to use feature layer and dynamic layer combination to achieve the target. Ie. showing all possible data in dynamic layer and by click on the feature transfer it to the feature layer and do the needed magic there.
0 Kudos
GhassanKarwchan
New Contributor III
thanks kajanus
It is a good idea.
I think we have to think in new way now for local stand-alone applications.
I used to think in "Engine-way" of thinking where local means fast.
0 Kudos
AnttiKajanus1
Occasional Contributor III
Your welcome. I have been very pleased about the performance with Runtime, but haven't worked yet with the large amount of local data and I can't compare it to Engine since I haven't touched it. It is true, that we need to change a bit our way of thinking/development since we are now working totally new product (with it's strengths and weaknesses). We also need to find new Best Practices and total NoGo's.

Anyway, using dynamic and feature layers together does not solve the real problem, that is the SEHException occuring when fetching the data.

I hope that someone from the Runtime team can check this problem and verify if it really is a bug or are we just missing something here.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

I have been testing your Map Package but unfortunately have not been able to reproduce the SEHException you were experiencing.

A feature layer is definitely not the best option for this type of layer though, as it seems to contain polygons with very complex geometry. When you're dealing with polygons, you need to take into account the total number of features and the complexity of the geometry (i.e. the number of vertices per polygon).

A dynamic map service layer is a better option for this type of data because the individual features and feature vertices are not loaded into memory within the client application.

One other thing to note is that local layers defined in XAML will automatically start the required local service, therefore you do not need to do this separately in code. If you'd prefer to define the local service in XAML in order to set properties such as the MaxRecords, you can do this as a resource:

...
<Grid.Resources>
    <esri:LocalFeatureService x:Key="FeatureService" Path="C:\Temp\SOPFIM_Full.mpk" MaxRecords="1000000" />
</Grid.Resources>
...
<esri:ArcGISLocalFeatureLayer ID="arcGISLocalFeatureLayer"
            Service="{StaticResource FeatureService}" 
            LayerName="ContourQC" IsHitTestVisible="False"/>


I also disabled hittesting on that layer too, which you can do to improve performance if you do not require hit testing for functionality such as MapTips.

Cheers

Mike
0 Kudos
GhassanKarwchan
New Contributor III
Thanks Mike
So, I fixed my problem by choosing Dynamic Layer.
So, I am going to ask you a question, and not for the problem, because the problem is fixed, but to learn best practices.
I used Feature Layer, because I want to use the identity task.
This is the reason I chose the feature layer.
So, I think that choice was valid for the task, but not for the size and complexity of the features.

If we need Identity task, we should use feature layer
Am I right?


Second,
In my case, the identity will be only required for the polygons where the client has buildings, which are only the main land and three other islands, which means three polygons out of 6500 polygons that are totally useless but we need to display them anyway.

So what the best practices in this way?

Like this example is going to be repeated for many clients (I believe), where you have contour for lands, which contains hundreds of small islands, and most of them useless because they are inhabitants, but you want to display them as background anyway, but you are interested in few polygons to get their attributes

Should you split this into two layers?
0 Kudos
AnttiKajanus1
Occasional Contributor III
I was playing around with this and made this kind of solution where I used Dynamic layer to show content, on click do Identify and draw results on the Graphcis layer:

    <Window.Resources>
        <esri:LocalFeatureService x:Key="FeatureService" Path="Data\\SOPFIM_Full.mpk" MaxRecords="3000" EnableDynamicLayers="True"/>
        <esri:SimpleRenderer x:Key="MySimpleRenderer">
            <esri:SimpleRenderer.Symbol>
                <esri:SimpleFillSymbol BorderBrush="Blue" BorderThickness="4" Fill="Red"/>
            </esri:SimpleRenderer.Symbol>
        </esri:SimpleRenderer>
    </Window.Resources>
 
    <Grid>  
        <esri:Map x:Name="_map" UseAcceleratedDisplay="True" IsEnabled="false" >
            <!-- ArcGIS Online Tiled Basemap Layer -->
            <esri:ArcGISTiledMapServiceLayer ID="World Topo Map" 
                       Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>


            <esri:ArcGISLocalDynamicMapServiceLayer Service="{StaticResource FeatureService}">
            </esri:ArcGISLocalDynamicMapServiceLayer>
            <esri:GraphicsLayer ID="Results" Renderer="{StaticResource MySimpleRenderer}"></esri:GraphicsLayer>
        </esri:Map>
    </Grid>


 public partial class MainWindow : Window
    {
        private const string PATH = "Data\\SOPFIM_Full.mpk";


        private LocalMapService _mapService;


        public MainWindow()
        {
            InitializeComponent();


            LocalMapService.GetServiceAsync(PATH, localMapService =>
            {
                _mapService = localMapService;
                _map.IsEnabled = true;
            });


            this._map.MouseClick += (s, e) =>
                {
                    var graphicsLayer = _map.Layers["Results"] as GraphicsLayer;
                    graphicsLayer.ClearGraphics();
                    
                    var task = new IdentifyTask(_mapService.UrlMapService);


                    var identifyParameters = new IdentifyParameters()
                        {
                            Geometry = e.MapPoint,
                            SpatialReference = _map.SpatialReference,
                            MapExtent = _map.Extent,
                            Width = (int)_map.ActualWidth,
                            Height = (int)_map.ActualHeight,
                            LayerOption = LayerOption.all
                        };


                    task.ExecuteCompleted += (se, ea) =>
                        {
                            if (ea.IdentifyResults != null && ea.IdentifyResults.Count > 0)
                            {
                                var layer = _map.Layers["Results"] as GraphicsLayer;
                                ea.IdentifyResults.ForEach(x => layer.Graphics.Add(x.Feature));                  
                            }
                        };
                    task.Failed += (se, ea) => MessageBox.Show(ea.Error.ToString());
                    task.ExecuteAsync(identifyParameters);
                };
        }


I think you can use this kind of solution.

When I create graphic from the BIG one, wait an age to get it drawn to the layer and then zoom in and I get again that SEHException. Note esri:LocalFeatureService initialization values.
0 Kudos