当前位置: 首页>>代码示例>>C#>>正文


C# FeatureLayer类代码示例

本文整理汇总了C#中FeatureLayer的典型用法代码示例。如果您正苦于以下问题:C# FeatureLayer类的具体用法?C# FeatureLayer怎么用?C# FeatureLayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FeatureLayer类属于命名空间,在下文中一共展示了FeatureLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

        private void Initialize()
        {
            // Create new Map
            Map myMap = new Map();

            // Create the uri for the tiled layer
            Uri tiledLayerUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer");

            // Create a tiled layer using url
            ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(tiledLayerUri);
            tiledLayer.Name = "Tiled Layer";

            // Add the tiled layer to map
            myMap.OperationalLayers.Add(tiledLayer);

            // Create the uri for the ArcGISMapImage layer
            var imageLayerUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer");

            // Create ArcGISMapImage layer using a url
            ArcGISMapImageLayer imageLayer = new ArcGISMapImageLayer(imageLayerUri);
            imageLayer.Name = "Image Layer";

            // Set the visible scale range for the image layer
            imageLayer.MinScale = 40000000;
            imageLayer.MaxScale = 2000000;

            // Add the image layer to map
            myMap.OperationalLayers.Add(imageLayer);

            //Create Uri for feature layer
            var featureLayerUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Recreation/FeatureServer/0");

            //Create a feature layer using url
            FeatureLayer myFeatureLayer = new FeatureLayer(featureLayerUri);
            myFeatureLayer.Name = "Feature Layer";

            // Add the feature layer to map
            myMap.OperationalLayers.Add(myFeatureLayer);

            // Create a mappoint the map should zoom to
            MapPoint mapPoint = new MapPoint(-11000000, 4500000, SpatialReferences.WebMercator);

            // Set the initial viewpoint for map
            myMap.InitialViewpoint = new Viewpoint(mapPoint, 50000000);

            // Initialize the model list with unknown status for each layer
            foreach (Layer layer in myMap.OperationalLayers)
            {
                _layerStatusModels.Add(new LayerStatusModel(layer.Name, "Unknown"));
            }

            // Create the tableview source and pass the list of models to it
            _tableView.Source = new LayerViewStatusTableSource(_layerStatusModels);

            // Event for layer view state changed
            _myMapView.LayerViewStateChanged += OnLayerViewStateChanged;

            // Provide used Map to the MapView
            _myMapView.Map = myMap;
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:60,代码来源:DisplayLayerViewState.cs

示例2: FeatureLayerHelper

        public FeatureLayerHelper(Map map, string name, FeatureLayer.QueryMode mode, bool visible)
        {
            this.FeatureLayer = (FeatureLayer)map.Layers.FirstOrDefault(layer => (layer is FeatureLayer) && ((FeatureLayer)layer).DisplayName.ToLower().Equals(name.ToLower()));
              if (this.FeatureLayer == null)
              {
            Log.Trace("Could not find layer with name '" + name + "'");
            return;
              }

              this.FeatureLayer.Visible  = visible;
              this.FeatureLayer.Mode     = mode;
              this.FeatureLayer.AutoSave = false;

              this.Fields = QueryLayerFields(this.FeatureLayer);
              if (this.Fields == null)
            Log.Trace("Could not query layer fields '" + name + "'");

              this.FeatureLayer.Initialized += FeatureLayer_Initialized;
              this.FeatureLayer.Initialize();

              this.FeatureLayer.BeginSaveEdits += FeatureLayer_BeginSaveEdits;
              this.FeatureLayer.EndSaveEdits += FeatureLayer_EndSaveEdits;
              this.FeatureLayer.UpdateCompleted += FeatureLayer_UpdateCompleted;
              this.FeatureLayer.UpdateFailed += FeatureLayer_UpdateFailed;
              this.FeatureLayer.SaveEditsFailed += FeatureLayer_SaveEditsFailed;
        }
开发者ID:RockDr,项目名称:route-monitor-for-geoevent,代码行数:26,代码来源:FeatureLayerHelper.cs

示例3: mapView_Initialized

        /// <summary>
        /// マップビュー初期化時のイベント ハンドラ
        /// </summary>
        private async void mapView_Initialized(object sender, EventArgs e)
        {
            try
            {
                //ローカル ジオデータベース(Runtime コンテンツ)を読み込みマップに追加
                var gdb = await Geodatabase.OpenAsync(GDB_PATH);
                foreach (var table in gdb.FeatureTables)
                {
                    var flayer = new FeatureLayer()
                    {
                        ID = table.Name,
                        DisplayName = table.Name,
                        FeatureTable = table
                    };

                    //フィーチャ レイヤーのラベル プロパティを初期化し赤ラベルと青ラベルを設定
                    flayer.Labeling = new LabelProperties();
                    var redLabelClass = this.layoutRoot.Resources["redLabel"] as AttributeLabelClass;
                    flayer.Labeling.LabelClasses.Add(redLabelClass);
                    var blueLabelClass = this.layoutRoot.Resources["blueLabel"] as AttributeLabelClass;
                    flayer.Labeling.LabelClasses.Add(blueLabelClass);

                    //マップにフィーチャ レイヤーを追加
                    mapView.Map.Layers.Add(flayer);
                }

                //すべてのレイヤーを初期化
                await mapView.LayersLoadedAsync();
            }
            catch(Exception ex)
            {
                MessageBox.Show(string.Format("フィーチャ レイヤーの作成に失敗しました: {0}", ex.Message));
            }
        }
开发者ID:EsriJapan,项目名称:arcgis-samples-dotnet,代码行数:37,代码来源:LabelingFeaturesByScale.xaml.cs

示例4: AddLocalToMap

        private async void AddLocalToMap(object sender, RoutedEventArgs e)
        {
            try {

                _gdb = await Geodatabase.OpenAsync(GDB_PATH);

                foreach (var table in _gdb.FeatureTables)
                {
                    try {
                        var flayer = new FeatureLayer {
                            ID = table.Name,
                            DisplayName = table.Name,
                            FeatureTable = table
                        };


                        MyMapView.Map.Layers.Add(flayer);
                        MyMapView.SetView(flayer.FullExtent);
                    }
                    catch (Exception ex) {
                        Console.WriteLine("Error creating feature layer: " + ex.Message, "Samples");
                    }
                }
            }
            catch (Exception ex) {
                Console.WriteLine("Error creating feature layer: " + ex.Message, "Samples");
            }
        }
开发者ID:fjkish,项目名称:DotNet,代码行数:28,代码来源:MainWindow.xaml.cs

示例5: FeatureLayerChangeVersion

        public FeatureLayerChangeVersion()
        {
            InitializeComponent();

            featureLayer = (MyMap.Layers["ServiceConnections"] as FeatureLayer);

            Geoprocessor gp_ListVersions = new Geoprocessor("http://sampleserver6.arcgisonline.com/arcgis/rest/services/GDBVersions/GPServer/ListVersions");

            gp_ListVersions.Failed += (s, a) =>
            {
                MessageBox.Show("Geoprocessing service failed: " + a.Error);
            };

            gp_ListVersions.ExecuteCompleted += (c, d) =>
            {
                VersionsCombo.DataContext = (d.Results.OutParameters[0] as GPRecordSet).FeatureSet;

                foreach (Graphic g in (d.Results.OutParameters[0] as GPRecordSet).FeatureSet.Features)
                {
                    if ((g.Attributes["name"] as string) == featureLayer.GdbVersion)
                    {
                        VersionsCombo.SelectedValue = g;
                        break;
                    }
                }
            };

            List<GPParameter> gpparams = new List<GPParameter>();
            gpparams.Add(new GPRecordSet("Versions", new FeatureSet()));
            gp_ListVersions.ExecuteAsync(gpparams);
        }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:31,代码来源:FeatureLayerChangeVersion.xaml.cs

示例6: Initialize

        private void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create and set initial map area
            Envelope initialLocation = new Envelope(
                -1.30758164047166E7, 4014771.46954516, -1.30730056797177E7, 4016869.78617381,
                SpatialReferences.WebMercator);
            myMap.InitialViewpoint = new Viewpoint(initialLocation);

            // Create uri to the used feature service
            var serviceUri = new Uri(
               "http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0");

            // Create feature table for the pools feature service
            ServiceFeatureTable poolsFeatureTable = new ServiceFeatureTable(serviceUri);

            // Define the request mode
            poolsFeatureTable.FeatureRequestMode = FeatureRequestMode.OnInteractionNoCache;

            // Create FeatureLayer that uses the created table
            FeatureLayer poolsFeatureLayer = new FeatureLayer(poolsFeatureTable);

            // Add created layer to the map
            myMap.OperationalLayers.Add(poolsFeatureLayer);

            // Assign the map to the MapView
            MyMapView.Map = myMap;
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:30,代码来源:ServiceFeatureTableNoCache.xaml.cs

示例7: RelateInfo

 /// <summary>
 /// Represents the Relationship Class information
 /// </summary>
 /// <param name="featureLayer"></param>
 /// <param name="selection"></param>
 public RelateInfo(FeatureLayer featureLayer, Selection selection)
 {
     _featureLayer = featureLayer;
     _selection = selection;            
     _featureClassName = _featureLayer.GetFeatureClass().GetName();
     
 }
开发者ID:ChaitG,项目名称:arcgis-pro-sdk-community-samples,代码行数:12,代码来源:RelateInfo.cs

示例8: CreateFeatureLayers

		private async void CreateFeatureLayers()
		{
			try
			{
				var geodatabase = await Geodatabase.OpenAsync(GeodatabasePath);

				Envelope extent = null;
				foreach (var table in geodatabase.FeatureTables)
				{
					var featureLayer = new FeatureLayer()
					{
						ID = table.Name,
						DisplayName = table.Name,
						FeatureTable = table
					};

					if (!Geometry.IsNullOrEmpty(table.ServiceInfo.Extent))
					{
						if (Geometry.IsNullOrEmpty(extent))
							extent = table.ServiceInfo.Extent;
						else
							extent = extent.Union(table.ServiceInfo.Extent);
					}

					MySceneView.Scene.Layers.Add(featureLayer);
				}

				await MySceneView.SetViewAsync(new Camera(new MapPoint(-99.343, 26.143, 5881928.401), 2.377, 10.982));
			}
			catch (Exception ex)
			{
				MessageBox.Show("Error creating feature layer: " + ex.Message, "Samples");
			}
		}
开发者ID:kbheadley,项目名称:NET,代码行数:34,代码来源:FeatureLayerFromLocalGeodatabase3d.xaml.cs

示例9: CreateFeatureLayers

        private async void CreateFeatureLayers()
        {
            try
            {
                var gdb = await Geodatabase.OpenAsync(GDB_PATH);

				Envelope extent = null;
                foreach (var table in gdb.FeatureTables)
                {
                    var flayer = new FeatureLayer()
                    {
                        ID = table.Name,
                        DisplayName = table.Name,
                        FeatureTable = table
                    };

					if (!Geometry.IsNullOrEmpty(table.ServiceInfo.Extent))
					{
						if (Geometry.IsNullOrEmpty(extent))
							extent = table.ServiceInfo.Extent;
						else
							extent = extent.Union(table.ServiceInfo.Extent);
					}

					MyMapView.Map.Layers.Add(flayer);
                }

				await MyMapView.SetViewAsync(extent.Expand(1.10));
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error creating feature layer: " + ex.Message, "Samples");
            }
        }
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:34,代码来源:FeatureLayerFromLocalGeodatabase.xaml.cs

示例10: FeatureLayerHitTesting

        /// <summary>Construct FeatureLayerHitTesting sample control</summary>
        public FeatureLayerHitTesting()
        {
            InitializeComponent();

            DataContext = this;
            _featureLayer = MyMapView.Map.Layers["FeatureLayer"] as FeatureLayer;
        }
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:8,代码来源:FeatureLayerHitTesting.xaml.cs

示例11: Initialize

        private async void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create a mappoint the map should zoom to
            MapPoint mapPoint = new MapPoint(-13630484, 4545415, SpatialReferences.WebMercator);

            // Set the initial viewpoint for map
            myMap.InitialViewpoint = new Viewpoint(mapPoint, 90000);

            // Provide used Map to the MapView
            _myMapView.Map = myMap;

            // Create the uri for the feature service
            Uri featureServiceUri = new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0");

            // Initialize feature table using a url to feature server url
            ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceUri);

            // Initialize a new feature layer based on the feature table
            _featureLayer = new FeatureLayer(featureTable);

            //Add the feature layer to the map
            myMap.OperationalLayers.Add(_featureLayer);
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-xamarin,代码行数:26,代码来源:FeatureLayerDefinitionExpression.cs

示例12: Initialize

        private async void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create a MapPoint the map should zoom to
            MapPoint mapPoint = new MapPoint(
                -13630484, 4545415, SpatialReferences.WebMercator);

            // Set the initial viewpoint for map
            myMap.InitialViewpoint = new Viewpoint(mapPoint, 90000);

            // Provide used Map to the MapView
            MyMapView.Map = myMap;

            // Create the uri for the feature service
            Uri featureServiceUri = new Uri(
                "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0");

            // Initialize feature table using a url to feature server url
            ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceUri);

            // Initialize a new feature layer based on the feature table
            _featureLayer = new FeatureLayer(featureTable);

            //Add the feature layer to the map
            myMap.OperationalLayers.Add(_featureLayer);

            // TODO: https://github.com/Esri/arcgis-runtime-samples-xamarin/issues/96
            if (Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Other)
            {
                await _featureLayer.RetryLoadAsync();
            }
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:34,代码来源:FeatureLayerDefinitionExpression.xaml.cs

示例13: Initialize

        private void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create and set initial map location
            MapPoint initialLocation = new MapPoint(
                -11000000, 5000000, SpatialReferences.WebMercator);
                myMap.InitialViewpoint = new Viewpoint(initialLocation, 100000000);

            // Create feature table using a url
            _featureTable = new ServiceFeatureTable(new Uri(_statesUrl));

            // Create feature layer using this feature table
            _featureLayer = new FeatureLayer(_featureTable);

            // Set the Opacity of the Feature Layer
            _featureLayer.Opacity = 0.6;

            // Create a new renderer for the States Feature Layer
            SimpleLineSymbol lineSymbol = new SimpleLineSymbol(
                SimpleLineSymbolStyle.Solid, Color.Black, 1); 
            SimpleFillSymbol fillSymbol = new SimpleFillSymbol(
                SimpleFillSymbolStyle.Solid, Color.Yellow, lineSymbol);

            // Set States feature layer renderer
            _featureLayer.Renderer = new SimpleRenderer(fillSymbol);

            // Add feature layer to the map
            myMap.OperationalLayers.Add(_featureLayer);

            // Assign the map to the MapView
            _myMapView.Map = myMap;
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-xamarin,代码行数:34,代码来源:FeatureLayerQuery.cs

示例14: EditingCodedValueDomains

        public EditingCodedValueDomains()
        {
            InitializeComponent();

            editor = LayoutRoot.Resources["MyEditor"] as Editor;
            featureLayer = MyMap.Layers["RecreationFacilities"] as FeatureLayer;
        }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:7,代码来源:EditingCodedValueDomains.xaml.cs

示例15: OnClick

        protected override void OnClick()
        {
            //
            //  TODO: Sample code showing how to access button host
            //
            ArcMap.Application.CurrentTool = null;

            //Create the workspace and then create the feature class.
            Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory");
            IWorkspaceFactory workspaceFactory = Activator.CreateInstance(factoryType) as IWorkspaceFactory;
            IWorkspace workspace = workspaceFactory.OpenFromFile(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), @"Data\testData.gdb").ToString(), 0);
            IFeatureWorkspace featureWorkspace = workspace as IFeatureWorkspace;

            IFeatureClass createdFeatureClass = CreateFeatureClass("Reddies", featureWorkspace);

            //Generate data for the feature class
            BoboDataGeneration(createdFeatureClass, featureWorkspace);

            //Create the layer and add it to the display
            IFeatureLayer layer = new FeatureLayer();
            layer.FeatureClass = createdFeatureClass;
            layer.Name = createdFeatureClass.AliasName;
            layer.DisplayField = "HistoField";

            RenderFeatures(layer);

            //Add the layer to the map
            ArcMap.Document.FocusMap.AddLayer(layer);
        }
开发者ID:nohe427,项目名称:MyAddins,代码行数:29,代码来源:HistoClass.cs


注:本文中的FeatureLayer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。