Each of these layers is defined with a single symbol in the service. (This seems to be a requirement to get the map tip to work.)
would it be best to create a FeatureLayer for each year, or can all 5 years be presented in a single FeatureLayer
Is there a sample around that shows how to render different symbols within a layer based on the attribute data?
<esri:FeatureLayer ID="ConstructionProjectsLines" DisableClientCaching="False" Url="http://gismaps.pagnet.org/ArcGIS/rest/services/Interactive_TIP_20111/MapServer/1" > <esri:FeatureLayer.MapTip> <Border CornerRadius="10" BorderBrush="SaddleBrown" BorderThickness="3" Margin="0,0,15,15" Background="LightGray"> <StackPanel Margin="7"> <StackPanel Orientation="Horizontal"> <TextBlock Text="Location: " Foreground="Black" FontWeight="Bold"/> <TextBlock Text="{Binding [ST_NAME]}" Foreground="Black" /> </StackPanel> </StackPanel> </Border> </esri:FeatureLayer.MapTip> </esri:FeatureLayer> <esri:FeatureLayer ID="ConstructionProjectsPoints" DisableClientCaching="False" Url="http://gismaps.pagnet.org/ArcGIS/rest/services/Interactive_TIP_20111/MapServer/0" > <esri:FeatureLayer.MapTip> <Border CornerRadius="10" BorderBrush="SaddleBrown" BorderThickness="3" Margin="0,0,15,15" Background="LightGray"> <StackPanel Margin="7"> <StackPanel Orientation="Horizontal"> <TextBlock Text="Location: " Foreground="Black" FontWeight="Bold"/> <TextBlock Text="{Binding [ST_NAME]}" Foreground="Black" /> </StackPanel> </StackPanel> </Border> </esri:FeatureLayer.MapTip> </esri:FeatureLayer>
<Grid.Resources> <esri2:SimpleFillSymbol x:Key="DefaultFillSymbol" Fill="#33FF0000" BorderBrush="Red" BorderThickness="2" /> <esri2:PictureMarkerSymbol x:Key="DefaultPictureSymbol" OffsetX="35" OffsetY="35" Source="component/Assets/images/identify.png" /> <esri2:SimpleMarkerSymbol x:Key="DefaultMarkerSymbol" Color="Aqua" Style="Circle" /> <esri2:SimpleMarkerSymbol x:Key="Year2011MarkerSymbol" Color="Green" Size="8" Style="Circle" /> <esri2:SimpleMarkerSymbol x:Key="Year2012MarkerSymbol" Color="Blue" Size="8" Style="Circle" /> <esri2:SimpleMarkerSymbol x:Key="Year2013MarkerSymbol" Color="Yellow" Size="8" Style="Circle" /> <esri2:SimpleMarkerSymbol x:Key="Year2014MarkerSymbol" Color="Orange" Size="8" Style="Circle" /> <esri2:SimpleMarkerSymbol x:Key="Year2015MarkerSymbol" Color="Red" Size="8" Style="Circle" /> <esri:UniqueValueRenderer x:Key="MyUniqueValueRenderer" Attribute="CONSTYEAR" > <esri:UniqueValueRenderer.Infos> <esri:UniqueValueInfo Value="2011" Symbol="{StaticResource Year2011MarkerSymbol}" /> <esri:UniqueValueInfo Value="2012" Symbol="{StaticResource Year2012MarkerSymbol}" /> <esri:UniqueValueInfo Value="2013" Symbol="{StaticResource Year2013MarkerSymbol}" /> <esri:UniqueValueInfo Value="2014" Symbol="{StaticResource Year2014MarkerSymbol}" /> <esri:UniqueValueInfo Value="2015" Symbol="{StaticResource Year2015MarkerSymbol}" /> </esri:UniqueValueRenderer.Infos> </esri:UniqueValueRenderer>
<esri:FeatureLayer ID="ConstructionProjectsPoints" DisableClientCaching="False" Url="http://gismaps.pagnet.org/ArcGIS/rest/services/Interactive_TIP_20111/MapServer/0" Renderer="{StaticResource MyUniqueValueRenderer}" Where="CONSTYEAR = 2011" > <esri:FeatureLayer.MapTip> <Border CornerRadius="10" BorderBrush="SaddleBrown" BorderThickness="3" Margin="0,0,15,15" Background="LightGray"> <StackPanel Margin="7"> <StackPanel Orientation="Horizontal"> <TextBlock Text="Location: " Foreground="Black" FontWeight="Bold"/> <TextBlock Text="{Binding [ST_NAME]}" Foreground="Black" /> </StackPanel> </StackPanel> </Border> </esri:FeatureLayer.MapTip> </esri:FeatureLayer>
You need to add OutFields="CONSTYEAR,ST_NAME" (or ="*")
Any insight into my custom renderer attempt?
<esri:FeatureLayer ID="ConstructionProjectsPoints" DisableClientCaching="False" Url="http://gismaps.pagnet.org/ArcGIS/rest/services/Interactive_TIP_2011/MapServer/0" Where="CONSTYEAR = 2011" OutFields="*" Renderer="{StaticResource MyUniqueValueRenderer}" > <esri:FeatureLayer.MapTip> <Border CornerRadius="10" BorderBrush="SaddleBrown" BorderThickness="3" Margin="0,0,15,15" Background="LightGray"> <StackPanel Margin="7"> <StackPanel Orientation="Horizontal"> <TextBlock Text="Location: " Foreground="Black" FontWeight="Bold"/> <TextBlock Text="{Binding [ST_NAME]}" Foreground="Black" /> </StackPanel> </StackPanel> </Border> </esri:FeatureLayer.MapTip> </esri:FeatureLayer>
CONSTYEAR (Type: esriFieldTypeSmallInteger, Alias: CONSTYEAR)
<esri:UniqueValueInfo Symbol="{StaticResource Year2011MarkerSymbol}"> <esri:UniqueValueInfo.Value> <sys:Int16>2011</sys:Int16> </esri:UniqueValueInfo.Value> </esri:UniqueValueInfo>
private void FeatureLayer_Initialized(object sender, System.EventArgs e) { UniqueValueRenderer uvr = (sender as FeatureLayer).Renderer as UniqueValueRenderer; foreach (var info in uvr.Infos) { if ((Int16)info.Value == (Int16)2011) info.Symbol = this.LayoutRoot.Resources["Year2011MarkerSymbol"] as Symbol; else if ((Int16)info.Value == (Int16)2012) info.Symbol = this.LayoutRoot.Resources["Year2012MarkerSymbol"] as Symbol; else if ((Int16)info.Value == (Int16)2013) info.Symbol = this.LayoutRoot.Resources["Year2013MarkerSymbol"] as Symbol; else if ((Int16)info.Value == (Int16)2014) info.Symbol = this.LayoutRoot.Resources["Year2014MarkerSymbol"] as Symbol; else if ((Int16)info.Value == (Int16)2015) info.Symbol = this.LayoutRoot.Resources["Year2015MarkerSymbol"] as Symbol; } }