zoukankan      html  css  js  c++  java
  • ArcGIS Pro二次开发-获得地图的信息和打开图层

      Map map = MapView.Active.Map;
                IEnumerable<Layer> layers = map.GetLayersAsFlattenedList(); //.Where(l => l.Name.Contains("world"))
                foreach (Layer lyr in layers)
                {
                    MessageBox.Show(lyr.Name);
                }
    
                MapView mapView = MapView.Active;
                IReadOnlyList<Layer> selectedLayers = mapView.GetSelectedLayers();
                foreach (Layer lyr in selectedLayers)
                {
                    MessageBox.Show("选择:"+lyr.Name);
                }
                IReadOnlyList<StandaloneTable> selectedTables = mapView.GetSelectedStandaloneTables();
                foreach (StandaloneTable ptab in selectedTables)
                {
                    MessageBox.Show("独立:"+ptab.Name);
                }
    
    //create a layer from a shapefile
    string uriShp = @"\MachineSharedFolderCensus.shp";
    Layer lyr = LayerFactory.Instance.CreateLayer(new Uri(uriShp), map);
    
    //create a layer from a feature class off an sde
    string uriSde = @"c:MyDataConnectionsMySDE.sdeCensus";
    Layer lyr = LayerFactory.Instance.CreateLayer(new Uri(uriSde), map);
    
    //create a layer using a URL
    string url = @"http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0";
    Layer lyr = LayerFactory.Instance.CreateLayer(new Uri(url), map);
    
    // create a layer and add it to a groupLayer
    string urlLyrx = @"\MachineSharedFolderCensus.lyrx";
    Layer lyr = LayerFactory.Instance.CreateLayer(new Uri(urlLyrx), grpLayer);

     

    var uri = new Uri(@"c:MyDataConnectionsMySDE.sdeLANDUSE_polygon");
    var createParams = new LayerCreationParams(uri)
    {
       Name = "Landuse",
       IsVisible = false,
    };
    
    var layer = LayerFactory.Instance.CreateLayer<Layer>(createParams, MapView.Active.Map);

    来自:https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Map-Authoring

  • 相关阅读:
    SFTP的使用
    java操作文件的创建、删除、遍历
    ios UICollectionView滑动时操作
    IOS自带json解析类解析json
    IOS把文件保存进沙盒目录
    python3.4安装suds
    Lua for windows中SciTe开启支持python的方法
    修改tabbarcontroller选中图片及选中颜色
    Android新版本SDK打开旧版本项目报错解决
    PHP5.4连接sqlserver
  • 原文地址:https://www.cnblogs.com/gisoracle/p/12489675.html
Copyright © 2011-2022 走看看