Thanks MikeSo, I fixed my problem by choosing Dynamic Layer.So, I am going to ask you a question, and not for the problem, because the problem is fixed, but to learn best practices.I used Feature Layer, because I want to use the identity task.This is the reason I chose the feature layer.So, I think that choice was valid for the task, but not for the size and complexity of the features.If we need Identity task, we should use feature layer Am I right?Second, In my case, the identity will be only required for the polygons where the client has buildings, which are only the main land and three other islands, which means three polygons out of 6500 polygons that are totally useless but we need to display them anyway.So what the best practices in this way?Like this example is going to be repeated for many clients (I believe), where you have contour for lands, which contains hundreds of small islands, and most of them useless because they are inhabitants, but you want to display them as background anyway, but you are interested in few polygons to get their attributesShould you split this into two layers?
<Window.Resources> <esri:LocalFeatureService x:Key="FeatureService" Path="Data\\SOPFIM_Full.mpk" MaxRecords="3000" EnableDynamicLayers="True"/> <esri:SimpleRenderer x:Key="MySimpleRenderer"> <esri:SimpleRenderer.Symbol> <esri:SimpleFillSymbol BorderBrush="Blue" BorderThickness="4" Fill="Red"/> </esri:SimpleRenderer.Symbol> </esri:SimpleRenderer> </Window.Resources> <Grid> <esri:Map x:Name="_map" UseAcceleratedDisplay="True" IsEnabled="false" > <!-- ArcGIS Online Tiled Basemap Layer --> <esri:ArcGISTiledMapServiceLayer ID="World Topo Map" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/> <esri:ArcGISLocalDynamicMapServiceLayer Service="{StaticResource FeatureService}"> </esri:ArcGISLocalDynamicMapServiceLayer> <esri:GraphicsLayer ID="Results" Renderer="{StaticResource MySimpleRenderer}"></esri:GraphicsLayer> </esri:Map> </Grid>
public partial class MainWindow : Window { private const string PATH = "Data\\SOPFIM_Full.mpk"; private LocalMapService _mapService; public MainWindow() { InitializeComponent(); LocalMapService.GetServiceAsync(PATH, localMapService => { _mapService = localMapService; _map.IsEnabled = true; }); this._map.MouseClick += (s, e) => { var graphicsLayer = _map.Layers["Results"] as GraphicsLayer; graphicsLayer.ClearGraphics(); var task = new IdentifyTask(_mapService.UrlMapService); var identifyParameters = new IdentifyParameters() { Geometry = e.MapPoint, SpatialReference = _map.SpatialReference, MapExtent = _map.Extent, Width = (int)_map.ActualWidth, Height = (int)_map.ActualHeight, LayerOption = LayerOption.all }; task.ExecuteCompleted += (se, ea) => { if (ea.IdentifyResults != null && ea.IdentifyResults.Count > 0) { var layer = _map.Layers["Results"] as GraphicsLayer; ea.IdentifyResults.ForEach(x => layer.Graphics.Add(x.Feature)); } }; task.Failed += (se, ea) => MessageBox.Show(ea.Error.ToString()); task.ExecuteAsync(identifyParameters); }; }
... <Grid.Resources> <esri:LocalFeatureService x:Key="FeatureService" Path="C:\Temp\SOPFIM_Full.mpk" MaxRecords="1000000" /> </Grid.Resources> ... <esri:ArcGISLocalFeatureLayer ID="arcGISLocalFeatureLayer" Service="{StaticResource FeatureService}" LayerName="ContourQC" IsHitTestVisible="False"/>
<Grid> <esri:Map x:Name="_map" UseAcceleratedDisplay="True" > <!-- ArcGIS Online Tiled Basemap Layer --> <esri:ArcGISTiledMapServiceLayer ID="World Topo Map" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/> <!--Local Feature Layer--> <esri:ArcGISLocalFeatureLayer ID="arcGISLocalFeatureLayer" Path="M:\ArcGIS\Databases\SOPFIM_Full.mpk" UpdateCompleted="ArcGISLocalFeatureLayer_UpdateCompleted" LayerName="ContourQC"> </esri:ArcGISLocalFeatureLayer> </esri:Map> <StackPanel> <TextBlock x:Name="txtBlock" VerticalAlignment="Top" HorizontalAlignment="Left"></TextBlock> <TextBlock x:Name="countBlock" VerticalAlignment="Top" HorizontalAlignment="Left"></TextBlock> </StackPanel> </Grid>
public MainWindow() { var localFeatureService = new LocalFeatureService() { MaxRecords = 10000, Path = @M:\ArcGIS\Databases\SOPFIM_Full.mpk, }; localFeatureService.Start(); InitializeComponent(); } private void ArcGISLocalFeatureLayer_UpdateCompleted(object sender, System.EventArgs e) { var layer = (sender as ArcGISLocalFeatureLayer); this.txtBlock.Text = layer.ExceededTransferLimit.ToString(); this.countBlock.Text = layer.Graphics.Count.ToString(); }
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.