Select to view content in your preferred language

Problem with ClassBreaksRenderer

1159
8
04-07-2011 03:24 PM
DonFreeman
Emerging Contributor
Can someone help me find the problem with this custom renderer?
 <esri2:SimpleLineSymbol x:Key="x0-5000LineSymbol" Color="Green" Width="1" Style="Solid" />
            <esri2:SimpleLineSymbol x:Key="x5001-10000LineSymbol" Color="Blue" Width="1" Style="Solid" />
            <esri2:SimpleLineSymbol x:Key="x10001-15000LineSymbol" Color="Yellow" Width="1" Style="Solid" />
            <esri2:SimpleLineSymbol x:Key="x15001-20000LineSymbol" Color="Orange" Width="1" Style="Solid" />
            <esri2:SimpleLineSymbol x:Key="x20001-25000LineSymbol" Color="Red" Width="1" Style="Solid" />
            
            <esri:ClassBreaksRenderer x:Key="MyClassBreaksRenderer" Attribute="tcmlatestcounts.adtnew" >
                <esri:ClassBreaksRenderer.Classes>
                    <esri:ClassBreakInfo MinimumValue="0" MaximumValue="5000" Symbol="{StaticResource x0-5000LineSymbol}" />
                    <esri:ClassBreakInfo MinimumValue="5001" MaximumValue="10000" Symbol="{StaticResource x5001-10000LineSymbol}" />
                    <esri:ClassBreakInfo MinimumValue="10001" MaximumValue="15000" Symbol="{StaticResource x10001-15000LineSymbol}" />
                    <esri:ClassBreakInfo MinimumValue="15001" MaximumValue="20000" Symbol="{StaticResource x15001-20000LineSymbol}" />
                    <esri:ClassBreakInfo MinimumValue="20001" MaximumValue="25000" Symbol="{StaticResource x20001-25000LineSymbol}" />
                </esri:ClassBreaksRenderer.Classes>
            </esri:ClassBreaksRenderer>


For some reason it fails when applied to my layer.
 <esri:FeatureLayer ID="RoadwaysLayer"
       DisableClientCaching="True" 
       Url="http://gismaps.pagnet.org/ArcGIS/rest/services/PAG_TrafficCounts/MapServer/3"
       OutFields="*" 
                           Renderer="MyClassBreaksRenderer"
       />


Thanks
0 Kudos
8 Replies
DominiqueBroux
Esri Frequent Contributor

Renderer="MyClassBreaksRenderer"



Try with Renderer="{StaticResource MyClassBreaksRenderer}":)
0 Kudos
DonFreeman
Emerging Contributor
Try with Renderer="{StaticResource MyClassBreaksRenderer}":)


DUH! That's why a second pair of eyes is always a good thing. Thanks

Now for my real problem. I have a service drawn from a file geodatabase. It contains a streets layer that is joined to a related table. The table contains a field (ADT) containing traffic count numbers for the roadway link. The native renderer in the service symbolizes the width of the line based on the ADT. This works well and renders properly in the mxd. It also renders properly when viewed in the ArcGIS.com maps (http://www.arcgis.com/home/webmap/viewer.html?url=http%3a%2f%2fgismaps.pagnet.org%2fArcGIS%2frest%2f...). However, when I place the layer into my Silverlight map, some of the links do not render properly and end up not being rendered. This is true even though an identify confirms that the needed ADT value is correct.

As a test I constructed the custom renderer to see if it would solve the problem, but it does not. The same links continue to not render. Any thoughts on what might be wrong?
0 Kudos
JenniferNery
Esri Regular Contributor
So your service already defines a ClassBreaksRenderer and you want to overwrite it by writing client-side ClassBreaksRenderer but the features are not rendered?

If yes, can you try to give your client-side ClassBreaksRenderer a DefaultSymbol and see if that will be picked up? If the DefaultSymbol shows, then the graphic attribute value did not fall in any range of your ClassBreaksInfo.

Also, where you able to verify that the service-defined renderer can be used if you don't set the FeatureLayer.Renderer?
0 Kudos
DonFreeman
Emerging Contributor
Jenn -
The features do not show up even when I set a default symbol in the client side renderer. However If I click where they are supposed to be I DO get the identify data associated with them. For now, we can abandon the client side renderer since I only wrote it to see if it would behave the same as the one in the service and it does. You can take a look at my map here:
http://gismaps.pagnet.org/PAG_TrafficCounts/SLTrafficCountstestpage.aspx#/map
It's still pretty rough but will illustrate the point. Notice the breaks in the roads just east and a little south of center. Try clicking where the road should be and you will see the identify attributes.
This is running with the service renderer.

Now, take a look at the same service via ArcGIS.com.
http://gismaps.pagnet.org/ArcGIS/rest/services/PAG_TrafficCounts/MapServer
You will have to zoom a bit to get down to the Tucson area. Notice that the streets do not have the breaks that are displayed on the silverlight page. Both situations are using plain jane rendering as defined in the service. I am curious as to why the difference.

Any thoughts?
0 Kudos
DonFreeman
Emerging Contributor
For anyone interested, here is some more info about this problem. The features still do not render when the server symbology is removed and all segments are drawn with a single default symbol. We therefore conclude that the problem has nothing to do with the classification scheme.

The original classification scheme DOES render properly when the map layer is changed from a FeatureLayer to a ArcGISDynamicMapServiceLayer. We therefore conclude that there is a problem with the FeatureLayer and that is why it is dropping some of the features. Since this is a roadway network made up of many small line segments, it may be that it is too large to display as a FeatureLayer or perhaps there is a bug in the ESRI control. Perhaps someone at ESRI can confirm this. If the former is the case, it would be nice to know the threshold at which a layer becomes too large for a FeatureLayer display.
0 Kudos
JenniferNery
Esri Regular Contributor
I tried the following code and the features drawn seem identical to the ArcGIS.com map.

<Grid x:Name="LayoutRoot" Background="White">
  <esri:Map x:Name="MyMap">
   <esri:Map.Extent>
    <esri:Envelope XMin="-184882.421916012" YMin="123158.170931756" XMax="1586575.68339895" YMax="2191434.90223097">
     <esri:Envelope.SpatialReference>
      <esri:SpatialReference WKID="2868"/>
     </esri:Envelope.SpatialReference>
    </esri:Envelope>
   </esri:Map.Extent>
   <!--<esri:ArcGISDynamicMapServiceLayer Url="http://gismaps.pagnet.org/ArcGIS/rest/services/PAG_TrafficCounts/MapServer"/>-->
   <esri:FeatureLayer Url="http://gismaps.pagnet.org/ArcGIS/rest/services/PAG_TrafficCounts/MapServer/4" Initialized="FeatureLayer_Initialized"/>
   <esri:FeatureLayer Url="http://gismaps.pagnet.org/ArcGIS/rest/services/PAG_TrafficCounts/MapServer/3" Initialized="FeatureLayer_Initialized"/>
   <esri:FeatureLayer Url="http://gismaps.pagnet.org/ArcGIS/rest/services/PAG_TrafficCounts/MapServer/2" Initialized="FeatureLayer_Initialized"/>
   <esri:FeatureLayer Url="http://gismaps.pagnet.org/ArcGIS/rest/services/PAG_TrafficCounts/MapServer/1" Initialized="FeatureLayer_Initialized"/>
   <esri:FeatureLayer Url="http://gismaps.pagnet.org/ArcGIS/rest/services/PAG_TrafficCounts/MapServer/0" Initialized="FeatureLayer_Initialized"/>
  </esri:Map>
 </Grid>


  private void FeatureLayer_Initialized(object sender, EventArgs e)
  {
   FeatureLayer layer = sender as FeatureLayer;
   System.Diagnostics.Debug.WriteLine("{0}-{1}", layer.LayerInfo.Name, layer.Renderer.GetType());
  }
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Hi Don,

I've tested your use case and it looks like you reach the limit of how many features you can get at once.
This limit is 1000 with ArcGIS server 10 and 500 with previous version.

A possible workaround is to use the 'OnDemand' mode for your feature layer so your features will be loaded when needed.
0 Kudos
DonFreeman
Emerging Contributor
Jenn - The problem is still there. Try looking only at layer 3.

Dominic - Your suggestion seems to help. Thanks.
0 Kudos