|
POST
|
I tweaked the FeatureLayerSimple sample to return only one feature (Where="CITY_NAME='Spokane'") and your initial code is still working. Though the code you just posted is not working since the FullExtent size is zero (the size of one point geometry is zero : that's normal). So I suggest that in this case you introduce a minimum size (as you did in your first post with 'coordOffset') Yup your right I changed the value to 0.01 and it worked fine.. thnx a bunch 🙂
... View more
01-12-2012
12:52 AM
|
0
|
0
|
638
|
|
POST
|
I tested your code with the FeatureLayerSimple interactive sample and it looks working (despite there is only one feature layer). Could you give more info on how to reproduce the issue? Thanks The code does work with a feature layer when the count is greater than 1 what I am talking is when the feature layer count is 1.. i.e only one feature.... for example in a graphics layer also when the graphic count is 1 the graphicsLayer.FullExtent.Width and graphicsLayer.FullExtent.Height is 0.0 but when the graphics count is greater than 2 it has values FeatureSet featureSet = e.FeatureSet;
if (featureSet != null && featureSet.Features.Count > 0)
{
// If an item has been selected
GraphicsLayer graphicsLayer = mainPage.map.Layers["tempGraphicLayer"] as GraphicsLayer;
if (graphicsLayer == null)
{
graphicsLayer = new GraphicsLayer();
graphicsLayer.ID = "tempGraphicLayer";
mainPage.map.Layers.Add(graphicsLayer);
}
Graphic selectedFeature = null;
for (int i = 0; i < featureSet.Features.Count; i++)
{
// Show selected feature attributes in DataGrid
selectedFeature = featureSet.Features;
selectedFeature.Symbol = LayoutRoot.Resources["MarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
graphicsLayer.Graphics.Add(selectedFeature);
}
graphicsLayer.Opacity = 0.7;
double expandPercentage = 30;
double widthExpand = graphicsLayer.FullExtent.Width * (expandPercentage / 100);
double heightExpand = graphicsLayer.FullExtent.Height * (expandPercentage / 100);
if (graphicsLayer != null)
{
ESRI.ArcGIS.Client.Geometry.Envelope displayExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(
graphicsLayer.FullExtent.XMin - (widthExpand / 2),
graphicsLayer.FullExtent.YMin - (heightExpand / 2),
graphicsLayer.FullExtent.XMax + (widthExpand / 2),
graphicsLayer.FullExtent.YMax + (heightExpand / 2));
mainPage.map.ZoomTo(displayExtent);
KeyValuePair<int, string> str = (KeyValuePair<int, string>)lstChainage.SelectedItem;
mainPage.lblcustomStatusBar.Content = str.Value + " located";
mainPage.lblcustomStatusBar.Foreground = new SolidColorBrush(Colors.Blue);
}
}
... View more
01-11-2012
06:57 PM
|
0
|
0
|
638
|
|
POST
|
Are you working with points? Thnk you for the reply.. Yes I am working with point features here...
... View more
01-10-2012
08:50 PM
|
0
|
0
|
638
|
|
POST
|
HI, I have a method which returns a feature layer and zooms to it on the map.. but when the feature layer count is 1 the map does not zoom to the feature.... //zoom to featurelayer
void featureLayer_UpdateCompleted(object sender, EventArgs e)
{
FeatureLayer projFeatureLayer = (FeatureLayer)sender;
SetLegend();
if (projFeatureLayer.FullExtent != null)
{
double projectXMin = projFeatureLayer.FullExtent.XMin;
double projectXMax = projFeatureLayer.FullExtent.XMax;
double projectYMin = projFeatureLayer.FullExtent.YMin;
double projectYMax = projFeatureLayer.FullExtent.YMax;
double coordOffset = .01;
//Envelope cannot be a single point?
if (projectXMin == projectXMax && projectYMin == projectYMax)
{
projectXMax = projectXMax + coordOffset;
projectXMin = projectXMin - coordOffset;
}
Envelope projectEnvelope = new Envelope(projectXMin, projectYMin, projectXMax, projectYMax);
mainPage.map.ZoomTo(projectEnvelope);
}
else
{
mainPage.lblcustomStatusBar.Content = "Feature not found";
mainPage.lblcustomStatusBar.Foreground = new SolidColorBrush(Colors.Red);
mainPage.panelCustomLegend.Visibility = System.Windows.Visibility.Collapsed;
}
} Please do guide...
... View more
01-09-2012
11:40 PM
|
0
|
6
|
1022
|
|
POST
|
HI, Thank you for your reply but I have done the coding and the language change works fine when I run the project on Visual Studio.. but when I deploy the project in IIS and then access it on the same system(browser) the language change does not take effect.. Do I need to Install some language(Tamil) font on the server or download something on the client Please guide..
... View more
11-10-2011
07:40 PM
|
0
|
0
|
387
|
|
POST
|
HI, I have created a website in using ArcGIS Silverlight API in two different languages i e English and Tamil. The website works fine in local but when I deployed it to the server the language does not change. am I missing something here should I do something extra to implement language that I am reading from the resource file.. Please guide....
... View more
11-03-2011
05:03 AM
|
0
|
3
|
735
|
|
POST
|
One way is you to use the LayerItemViewModel 'Tag' property to store your length. You can initialize the 'Tag' property by code on event legend 'Refreshed' and then just display it with a Binding to Tag. For more complex scenarios, you can also set the Tag property to a dictionary and use a binding such as {Binding Tag[Length]} (by supposing your dictionary has a 'Length' entry) Thank you tag worked <sdk:Label x:Name="label1" Content="{Binding Tag}" MinWidth="40"/> dicSurfaceLength = e.Result;
foreach (LegendItemViewModel legendItems in mainPage.CustomLegend.LayerItems[0].LegendItems)
{
legendItems.Tag = e.Result[legendItems.Label];
}
... View more
10-18-2011
06:28 AM
|
0
|
0
|
393
|
|
POST
|
One way is you to use the LayerItemViewModel 'Tag' property to store your length. You can initialize the 'Tag' property by code on event legend 'Refreshed' and then just display it with a Binding to Tag. For more complex scenarios, you can also set the Tag property to a dictionary and use a binding such as {Binding Tag[Length]} (by supposing your dictionary has a 'Length' entry) Hi thank you for your reply I tried doing it the way you suggested void CustomLegend_Refreshed(object sender, ESRI.ArcGIS.Client.Toolkit.Legend.RefreshedEventArgs e)
{
if (boolRefreshLegend)
{
string[] str = new string[lstRoadSurfaceTypes.SelectedItems.Count];
for (int i = 0; i < lstRoadSurfaceTypes.SelectedItems.Count; i++)
{
KeyValuePair<int, string> ListItemKeyValuePair = (KeyValuePair<int, string>)lstRoadSurfaceTypes.SelectedItems;
str = ListItemKeyValuePair.Value;
}
e.LayerItem.Tag = "52 kms";
var fLayer = e.LayerItem.Layer as FeatureLayer;
if (fLayer != null && fLayer.ID == "Road Surface Type" && e.LayerItem.LegendItems != null)
{
var toRemove = e.LayerItem.LegendItems.Where(item => item.Label != str[0]).ToArray();
int intLegendItemCount = e.LayerItem.LegendItems.Count;
for (int i = 0; i < str.Count(); i++)
{
toRemove = toRemove.Where(item => item.Label != str).ToArray();
}
LegendItemViewModel itemmodel = mainPage.CustomLegend.LayerItems[0];
itemmodel .Tag = "Black Top";
foreach (var item in toRemove)
e.LayerItem.LegendItems.Remove(item);
}
}
} <esri:Legend.LegendItemTemplate>
<DataTemplate >
<StackPanel Orientation="Horizontal" x:Name="stackpanel1">
<Image Source="{Binding ImageSource}"></Image>
<sdk:Label Content="{Binding Label}" MinWidth="40"/>
<sdk:Label x:Name="label1" Content="{Binding Tag}" MinWidth="40"/>
</StackPanel>
</DataTemplate>
</esri:Legend.LegendItemTemplate> Please guide me here
... View more
10-18-2011
03:43 AM
|
0
|
0
|
393
|
|
POST
|
HI, I am using a Legend template... Here I want to show the polyline length which I query from the database <esri:Legend Map="{Binding ElementName=map}" MaxHeight="300" MinHeight="100"
LayerItemsMode="Tree"
ShowOnlyVisibleLayers="True" x:Name="CustomLegend" >
<esri:Legend.MapLayerTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox Content="{Binding Label}"/>
<!--<Slider Maximum="1" Value="{Binding Layer.Opacity, Mode=TwoWay}" Width="50" />-->
</StackPanel>
</DataTemplate>
</esri:Legend.MapLayerTemplate>
<esri:Legend.LegendItemTemplate>
<DataTemplate >
<StackPanel Orientation="Horizontal" x:Name="stackpanel1">
<Image Source="{Binding ImageSource}"></Image>
<sdk:Label Content="{Binding Label}" MinWidth="40"/>
<sdk:Label Content="{Binding Keys}" MinWidth="50"/>
>
</StackPanel>
</DataTemplate>
</esri:Legend.LegendItemTemplate>
<esri:Legend.LayerTemplate>
<DataTemplate>
<CheckBox Content="{Binding Label}"
IsChecked="{Binding IsEnabled, Mode=TwoWay}"
IsEnabled="{Binding IsInScaleRange}" >
</CheckBox>
</DataTemplate>
</esri:Legend.LayerTemplate>
</esri:Legend> how do I bind the values that I have in a Dictionary? Please guide..
... View more
10-15-2011
06:58 AM
|
0
|
3
|
2442
|
|
POST
|
HI, I have a layer(polyline) drawn from Oracle through sde .. and saved in a mxd I have created symbology in by selecting a value field (Surface Type) I have 6 Surface types for now so it has created 6 symbols but now if I add another new Surface Type with geometry in the database how can I make that to reflect in my map and under what symbology will that be display FYI : I have used makerouteevent to create the layer (Linear Referencing) Please guide...
... View more
10-13-2011
06:29 AM
|
0
|
1
|
1487
|
|
POST
|
The legend control worked well ESRI.ArcGIS.Client.Toolkit.Legend.RefreshedEventArgs e)
{
var fLayer = e.LayerItem.Layer as FeatureLayer;
if (fLayer != null && fLayer.ID == "MyFeatureLayer2" && e.LayerItem.LegendItems != null)
{
var toRemove = e.LayerItem.LegendItems.Where(item => item.Label != "7").ToArray(); // Warning : may be a coded value instead of just '7'. Depending on your model
foreach (var item in toRemove)
e.LayerItem.LegendItems.Remove(item);
}
} but I display the Label with its symbol.. I want to add the length of the polyline(road) in KMs which will be queryed from the database.. is this possible ..
... View more
10-11-2011
11:44 PM
|
0
|
0
|
539
|
|
POST
|
Hi, I have created a FeatureLayer to show the road surface type I am adding the layer using the where clause to the map.. the map has been added successfully.. but I also have to show the Legend symbol of the queried result and not the whole Legend <esri:Legend Map="{Binding ElementName=map}" Margin="0,0,80,0"
LayerItemsMode="Tree" HorizontalAlignment="Right"
ShowOnlyVisibleLayers="True" x:Name="CustomLegend"
/> FeatureLayer MyFeatureLayer2 = new FeatureLayer();
MyFeatureLayer2.Url = "http://192.168.1.52/ArcGIS/rest/services/LRS_CW_SURFACE_TYPE/MapServer/0";
MyFeatureLayer2.Where = "SURFACING_TYPE = 7";
MyFeatureLayer2.OutFields.AddRange(new string[] { "SURFACING_TYPE" });
MyFeatureLayer2.ID = "RoadSurfaceType";
MyFeatureLayer2.ID = "MyFeatureLayer2";
mainPage.map.Layers.Add(MyFeatureLayer2);
mainPage.map.ZoomTo(MyFeatureLayer2.Geometry);
String[] aerialList = { "RoadSurfaceType" };
mainPage.CustomLegend.LayerIDs = aerialList;
mainPage.CustomLegend.LayerItemsMode = ESRI.ArcGIS.Client.Toolkit.Legend.Mode.Flat;
mainPage.CustomLegend.Visibility = System.Windows.Visibility.Visible;
mainPage.CustomLegend.Refresh(); but the full legend is still visible please help me on this
... View more
10-03-2011
03:58 AM
|
0
|
1
|
733
|
|
POST
|
The problem is coming from your ItemsSource binding: With this binding you will get all renderer infos whatever it's used or not. One option is you to implement by code your own enumeration that returns only the symbols used in the layer. Hi, Thanks you for your reply I have been breaking my head over this trying to remove items from the Legend control.. Can you please throw in a little bit of code that would help me overcome this issue
... View more
10-03-2011
02:12 AM
|
0
|
0
|
539
|
|
POST
|
HI, I have a FeatureLayer <esri:Map x:Name="MyMap" >
<esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
<esri:FeatureLayer ID="MyFeatureLayer2"
Url="http://192.168.1.52/ArcGIS/rest/services/RMS_BOUNDARIES/MapServer/1"
Where="DISTRICT_ID = 5" >
</esri:FeatureLayer>
</esri:Map> here the map shows the District whos ID is 5.. but when I bind this featureLayer to esriToolkitPrimitives <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ListBox Margin="0" IsHitTestVisible="False" BorderThickness="0"
ItemsSource="{Binding ElementName=MyMap, Path=Layers.[MyFeatureLayer2].LayerInfo.Renderer.Infos}"
Grid.Row="1">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<esriToolkitPrimitives:SymbolDisplay
Symbol="{Binding Symbol}"
Width="20" Height="20"
VerticalAlignment="Center" />
<TextBlock Text="{Binding Label}"
FontSize="10"
VerticalAlignment="Center"
Margin="5,0,0,0" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</ScrollViewer> The listbox still shows all the layers in it.. I want to only show the Item whose Id is 5 how do i achieve this
... View more
10-01-2011
12:43 AM
|
0
|
4
|
896
|
|
POST
|
Hi, I have developed a identify tool where I am reading my LayerKeyField from the IdentifyResults int intFeatureCount = 0;
//store LayerName and ID
foreach (IdentifyResult result in results)
{
if (!dicIdentifyResults.Keys.Contains(Convert.ToInt32(results[intFeatureCount].Feature.Attributes["ROADID"])))
{
//store identify results with the layername
dicIdentifyResults.Add(Convert.ToInt32(results[intFeatureCount].Feature.Attributes["ROADID"]), results[intFeatureCount].LayerName);
intFeatureCount++;
}
} the above code works fine... but When I query the using QueryTask and read my attribute from that result I dont get the value FeatureSet pFeatureSet = e.FeatureSet;
if (pFeatureSet == null) return;
if (pFeatureSet.Count() < 1) return;
int intID = Convert.ToInt32(pFeatureSet.Features[0].Attributes["ROADID"])
//but
int intID = Convert.ToInt32(pFeatureSet.Features[0].Attributes["roadid"])
; but when I use lower case keyfieldname it works fine .. how is it that it works fine for IdentifyTask but QueryTask I have also changed the alias name of field to Uppper case in using ArcMap am i missing something here
... View more
09-20-2011
03:53 AM
|
0
|
1
|
680
|
| Online Status |
Offline
|
| Date Last Visited |
09-07-2025
09:04 AM
|