Select to view content in your preferred language

Graphics and Symbology

2835
19
02-10-2011 06:18 AM
JayKappy
Frequent Contributor
I have a feature set that I am quering.  Graphics are created and placed on the map using a predefined symbol.  Everything works great.
But I want to symbols to reflect the data....say they are police incidents.  I want a grpahic for Burglary, Car Accident etc etc.
What are my options here....do I apply an image to the graphic instead of a symbol? 
Keeping in mind that I want to also address speed...I dont want to be drawing tons of images etc.

Thoughts?

Thanks
0 Kudos
19 Replies
JayKappy
Frequent Contributor
I suggest you add a default symbol to your unique value renderer, so we will know if the issue is coming from the values of your attribute 'TYPE'.


I tried this .... No go....But dont even know if i can do what I did below..or if thats what you were talking about...
            <esri:SimpleMarkerSymbol x:Key="BLUEMarkerSymbol" Color="Blue" Size="12" Style="Circle" />
            <esri:SimpleMarkerSymbol x:Key="PURPLEMarkerSymbol" Color="Purple" Size="12" Style="Circle" />

            <esri:UniqueValueRenderer x:Key="MyUniqueValueRenderer" Attribute="TYPE" DefaultSymbol="BLUEMarkerSymbol" >
                <esri:UniqueValueRenderer.Infos>
                    <esri:UniqueValueInfo Value="Church" Symbol="{StaticResource PURPLEMarkerSymbol}" />
                    <esri:UniqueValueInfo Value="SCHOOL" Symbol="{StaticResource PURPLEMarkerSymbol}" />
                </esri:UniqueValueRenderer.Infos>
            </esri:UniqueValueRenderer>
0 Kudos
DominiqueBroux
Esri Frequent Contributor
It's something like:

          <esri:UniqueValueRenderer x:Key="MyUniqueValueRenderer" Attribute="TYPE" DefaultSymbol="{StaticResource BLUEMarkerSymbol}">
                <esri:UniqueValueRenderer.Infos>
                    <esri:UniqueValueInfo Value="Church" Symbol="{StaticResource BLUEMarkerSymbol}" />
                    <esri:UniqueValueInfo Value="SCHOOL" Symbol="{StaticResource PURPLEMarkerSymbol}" />
                </esri:UniqueValueRenderer.Infos>
            </esri:UniqueValueRenderer>
0 Kudos
JayKappy
Frequent Contributor
I have no idea whats going on here....as soon as I put in the line Renderer="MyUniqueValueRenderer" it errors out...

I remove teh line and then uncomment this line in my VB code and It works fine...but not rendering the features...
selectedGraphic.Symbol = TryCast(LayoutRoot.Resources("StrobeMarkerSymbol_Blue"), ESRI.ArcGIS.Client.Symbols.Symbol)


Not these Graphics are derived from a query that finds a parcel, buffers the parcel and then grabs the points that are in that buffer and then draws them....the later is what I am trying to symbolize...

Any other thoughts....I think there is something messed up here but cant see it....It should be working.

            <!-- UNIQUE VALUE RENDERER  -->
            <esri:SimpleMarkerSymbol x:Key="BLUEMarkerSymbol" Color="Blue" Size="12" Style="Circle" />
            <esri:SimpleMarkerSymbol x:Key="PURPLEMarkerSymbol" Color="Purple" Size="12" Style="Circle" />

            <esri:UniqueValueRenderer x:Key="MyUniqueValueRenderer" Attribute="TYPE" DefaultSymbol="{StaticResource BLUEMarkerSymbol}">
                <esri:UniqueValueRenderer.Infos>
                    <esri:UniqueValueInfo Value="Church" Symbol="{StaticResource PURPLEMarkerSymbol}" />
                    <esri:UniqueValueInfo Value="SCHOOL" Symbol="{StaticResource PURPLEMarkerSymbol}" />
                </esri:UniqueValueRenderer.Infos>
            </esri:UniqueValueRenderer>



                    <esri:GraphicsLayer ID="MyGraphicsLayerBufferResults" 
                                        MouseEnter="imageBuffer_Mousehover" 
                                        MouseLeftButtonDown="GraphicsLayerBuffer_MouseLeftButtonDown"
                                        Renderer="MyUniqueValueRenderer"
                                        >
                        <esri:GraphicsLayer.MapTip>
                            <Border esri:GraphicsLayer.MapTipHideDelay="00:00:01.5" 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="#FF092959" Offset="0.946"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                                <Border.Effect>
                                    <DropShadowEffect ShadowDepth="10" BlurRadius="14" Direction="300" />
                                </Border.Effect>
                                <StackPanel Orientation="Vertical">
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="Distance: " FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
                                        <TextBlock Text="{Binding [BUFFER_DISTANCE]}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                        <TextBlock Text="  meters from parcel" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
                                    </StackPanel>
                                  </StackPanel>
                            </Border>
                        </esri:GraphicsLayer.MapTip>

                    </esri:GraphicsLayer>


    Private Sub QueryTask_ExecuteCompletedBuffer2(ByVal sender As Object, ByVal args As QueryEventArgs)

        Dim featureSet As FeatureSet = args.FeatureSet
        If args.FeatureSet.Features.Count < 1 Then
            MessageBox.Show("No features found")
            Return
            End If
        For Each selectedGraphic As Graphic In args.FeatureSet.Features
           '  Commented out
            ' selectedGraphic.Symbol = TryCast(LayoutRoot.Resources("StrobeMarkerSymbol_Blue"), ESRI.ArcGIS.Client.Symbols.Symbol)            
           _resultsGraphicsLayer.Graphics.Add(selectedGraphic)

        Next selectedGraphic
0 Kudos
JenniferNery
Esri Regular Contributor
This line Renderer="MyUniqueValueRenderer" is not correct. Renderer property expects IRenderer not a string, therefore you need to change it to:
Renderer="{StaticResource MyUniqueValueRenderer}"

This will point to a resource in your dictionary.
0 Kudos
JayKappy
Frequent Contributor
Thanks Jennifer and Dominique....I dont know how I got that syntax for the Renderer line...I swore I copied it from the ESRI examples....maybe I wrote the line myself....either way thank you

Things are working now....on to another unknown....your help is very appreciated....thank you
0 Kudos
JayKappy
Frequent Contributor
Last question....using the Class Breaks Renderer

I have a feature class that has a field called "PRECINCTS_" and its DOUBLE
The field values range from 1-30
I am trying this and only getting the default. 

Thoughts?

            <esri:SimpleFillSymbol x:Key="MyYellowFillSymbol" Fill="#44FFFF00" BorderBrush="Transparent" BorderThickness="2" />
            <esri:SimpleFillSymbol x:Key="MyRedFillSymbol" Fill="#44FF0000" BorderBrush="Transparent" BorderThickness="2" />
            <esri:SimpleFillSymbol x:Key="MyBlueFillSymbol" Fill="Blue" BorderBrush="Transparent" BorderThickness="2" />
            <esri:ClassBreaksRenderer x:Key="MyClassBreaksRenderer" Attribute="PRECINCTS_" DefaultSymbol="{StaticResource MyRedFillSymbol}">
               <esri:ClassBreaksRenderer.Classes>
                    <esri:ClassBreakInfo MinimumValue="0.0000" MaximumValue="8.0000" Symbol="{StaticResource MyYellowFillSymbol}" />
                    <esri:ClassBreakInfo MinimumValue="8.0001" MaximumValue="15.0000" Symbol="{StaticResource MyRedFillSymbol}" />
                    <esri:ClassBreakInfo MinimumValue="15.0001" MaximumValue="50.0000" Symbol="{StaticResource MyBlueFillSymbol}" />
               </esri:ClassBreaksRenderer.Classes>
            </esri:ClassBreaksRenderer>
0 Kudos
JayKappy
Frequent Contributor
GOT IT!!!!!

Didnt specify any out fields for the Renderer to render against...

                    <esri:FeatureLayer ID="MG_PrecinctsClassBreak" 
                     Url="http://gis.logis.org/arcgis/rest/services/MG_Test/MapServer/6"
                    Renderer="{StaticResource MyClassBreaksRenderer}"
                    OutFields="PRECINCTS_"   />
0 Kudos
JayKappy
Frequent Contributor
Is there limit on the number of features that can be calculated in the ClassBreakRender...I have it working for a feature that has 5 records.
I then try it against my parcels feature class...about 25,000 records.  It starts to draw but only gets about 5% and then stops drawing

Thanks
0 Kudos
JenniferNery
Esri Regular Contributor
The service may have reached its limit of how many features it can return at once (the default is 500 for ArcGIS Server 9.3.1, 1000 for ArcGIS Server 10, 1000 for MapIt). Post# 2 on this thread is a good response to your question 🙂 http://forums.arcgis.com/threads/17522-Cannot-add-Layer-with-more-than-500-Features
0 Kudos
JayKappy
Frequent Contributor
Great....well sort of....Its good that I know its not something in my code or dataset.  Knowing I hit an acutal limitation is all I needed to know...
Thank you for teh reference material...will look into that..

THanks
0 Kudos