Select to view content in your preferred language

Feature Layer SnapShot not loading

2531
5
11-10-2010 06:20 AM
KeithSearles
Emerging Contributor
I am trying to use SnapShot mode with a Features Layer that I have in my application, however the data is not loading. When using the OnDemand mode however, everything works as intended. What do I need to do specifically to get the Features layer to show the data that I am querying in Snapshot mode?

Thanks in advance for all of your help.

Listed below is my XAML for the features layer, it is nested in an Map.
[HTML]
<esri:FeatureLayer ID="CensusDemographics"
                Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/1"
                                       
                Mode="Snapshot"
                OutFields="*"
                Renderer="{StaticResource MyClassBreakRenderer}"
                
                Where="CNTY_FIPS = '031'"            
                >
               
                <esri:FeatureLayer.MapTip>
                    <Border CornerRadius="10" BorderBrush="#FF222957" BorderThickness="3" Margin="0,0,15,15">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="1.038,1.136" StartPoint="0.015,0.188">
                                <GradientStop Color="#FFD1DFF2"/>
                                <GradientStop Color="#FF0088FF" Offset="0.946"/>
                            </LinearGradientBrush>
                        </Border.Background>
                        <Border.Effect>
                            <DropShadowEffect ShadowDepth="10" BlurRadius="14" Direction="300" />
                        </Border.Effect>
                        <StackPanel Margin="7">
                           
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Population: " Foreground="Black" />
                                <TextBlock Text="{Binding [POP2007]}" Foreground="Black" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Population Per SqMi.: " Foreground="Black" />
                                <TextBlock Text="{Binding [POP07_SQMI]}" Foreground="Black" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="STCOFIPS: " Foreground="Black" />
                                <TextBlock Text="{Binding [STCOFIPS]}" Foreground="Black" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="TRACT: " Foreground="Black" />
                                <TextBlock Text="{Binding [TRACT]}" Foreground="Black" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="BLKGRP: " Foreground="Black" />
                                <TextBlock Text="{Binding [BLKGRP]}" Foreground="Black" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="FIPS: " Foreground="Black" />
                                <TextBlock Text="{Binding [FIPS]}" Foreground="Black" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="CNTY_FIPS: " Foreground="Black" />
                                <TextBlock Text="{Binding [CNTY_FIPS]}" Foreground="Black" />
                            </StackPanel>
                        </StackPanel>
                    </Border>
                </esri:FeatureLayer.MapTip>
            </esri:FeatureLayer>
[/HTML]
0 Kudos
5 Replies
JenniferNery
Esri Regular Contributor
I was not able to replicate the problem. I performed QueryLayer from the web browser to find out how many features I should expect given the Where clause you provided. I was able to switch between the two modes and still get 1000 features. I subscribed to Initialized and UpdatedCompleted to make sure that the layer InitializationFailure is null and that Graphics.Count is also 1000. 

What version of the API are you using? Could you try to run Fiddler before you launch your SL app?
Kindly refer to this blog post: http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2009/08/24/Troubleshooting-blank-layers.aspx
0 Kudos
KeithSearles
Emerging Contributor
When I set an event handler for the layer's initialization, it looks like objects are being returned, however they're just not being painted to the layer...I'm wondering if I just have a value or property misconfigured?

Here is my map tag in it's entirety, including the feature layer.

[HTML]
<esri:Map x:Name="MyMap" Extent="-16697923.618991,-6654565.46602204,16697923.618991,17327334.2828281" MouseClick="QueryPoint_MouseClick">
            <esri:Map.Template>
                <ControlTemplate>
                    <Grid Background="{TemplateBinding Background}">
                        <Grid x:Name="RootElement" Width="Auto" Height="Auto" />
                        <Rectangle x:Name="ZoomBox" Fill="#55FFFFFF" Stroke="Green" StrokeThickness="2" Visibility="Collapsed" />
                        <StackPanel Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Bottom">
                            <esri:ScaleBar x:Name="MyScaleBar" Margin="5" MapUnit="DecimalDegrees" Foreground="Black"
                                           DisplayUnit="Miles" Map="{Binding ElementName=MyMap}" />
                            <TextBlock Foreground="Black" Text="{Binding ElementName=MyMap, Path=Layers.[BingLayer].CopyrightText}" Margin="5" />
                        </StackPanel>
                    </Grid>
                </ControlTemplate>
            </esri:Map.Template>
            <bing:TileLayer ID="BingLayer" LayerStyle="Road" Visible="True" ServerType="Production"
                   Token=[TokenRemoved] />
            <esri:FeatureLayer ID="CensusDemographics"         Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/1"                                       
                Mode="Snapshot"
                OutFields="*"
                Renderer="{StaticResource MyClassBreakRenderer}"
                OnDemandCacheSize="500"
                Where="CNTY_FIPS = '031'"            
                >
                <esri:FeatureLayer.MapTip>
                    <Border CornerRadius="10" BorderBrush="#FF222957" BorderThickness="3" Margin="0,0,15,15">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="1.038,1.136" StartPoint="0.015,0.188">
                                <GradientStop Color="#FFD1DFF2"/>
                                <GradientStop Color="#FF0088FF" Offset="0.946"/>
                            </LinearGradientBrush>
                        </Border.Background>
                        <Border.Effect>
                            <DropShadowEffect ShadowDepth="10" BlurRadius="14" Direction="300" />
                        </Border.Effect>
                        <StackPanel Margin="7">
                           
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Population: " Foreground="Black" />
                                <TextBlock Text="{Binding [POP2007]}" Foreground="Black" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Population Per SqMi.: " Foreground="Black" />
                                <TextBlock Text="{Binding [POP07_SQMI]}" Foreground="Black" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="STCOFIPS: " Foreground="Black" />
                                <TextBlock Text="{Binding [STCOFIPS]}" Foreground="Black" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="TRACT: " Foreground="Black" />
                                <TextBlock Text="{Binding [TRACT]}" Foreground="Black" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="BLKGRP: " Foreground="Black" />
                                <TextBlock Text="{Binding [BLKGRP]}" Foreground="Black" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="FIPS: " Foreground="Black" />
                                <TextBlock Text="{Binding [FIPS]}" Foreground="Black" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="CNTY_FIPS: " Foreground="Black" />
                                <TextBlock Text="{Binding [CNTY_FIPS]}" Foreground="Black" />
                            </StackPanel>
                        </StackPanel>
                    </Border>
                </esri:FeatureLayer.MapTip>
            </esri:FeatureLayer>
            <esri:GraphicsLayer ID="GeocodeResultsGraphicsLayer" MouseLeftButtonDown="GraphicsLayer_MouseLeftButtonDown">
                <esri:GraphicsLayer.MapTip>
                    <Grid>
                        <Border BorderBrush="Black" CornerRadius="10"  BorderThickness="1" Background="#FFFFE300" />
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Text="{Binding [DisplayName]}" HorizontalAlignment="Left" />
                        </StackPanel>
                    </Grid>
                </esri:GraphicsLayer.MapTip>
            </esri:GraphicsLayer>
            <esri:GraphicsLayer ID="GeocodeFindResultsGraphicsLayer">
            </esri:GraphicsLayer>
        </esri:Map>
[/HTML]

Is there anything I need to kick off in the backend to update the layer?
0 Kudos
JenniferNery
Esri Regular Contributor
It is possible that the problem lies on how you defined your ClassBreakRenderer. Have you looked at this sample? http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#RenderersXAML

The Attribute property must match a field in your FeatureLayer. Also when you perform the same query on your web browser, look at the features' value for this field and see if any of them would fall in the ClassBreakInfo you've created.

A quick check would be to set the DefaultSymbol for your ClassBreakRenderer, it is possible that the features just do not fall in any of the defined ClassBreakInfo Min/Max range.
0 Kudos
KeithSearles
Emerging Contributor
I checked with Fiddler and the API is returning the correct data that I need, as well as set a Default Symbol, but still no luck.

It's odd, if I change the Feature Layer's Mode attribute to "OnDemand", it displays the layer no problem, however just simply changing it to "SnapShot" still is not causing it to load.
0 Kudos
JenniferNery
Esri Regular Contributor
You are returning 1000 features, right? Do you wait awhile to see if they go to Initialized method? Do you get 1000 features as expected?  Both modes should work. I tried it with your code. However I didn't have your Renderer code. Without the renderer, do you see the features drawn?  You confirm that the features do come back right but are not drawn?
0 Kudos