当前位置: 首页 > news >正文

cdn加速国外服务器seo推广代运营

cdn加速国外服务器,seo推广代运营,顺的网络做网站好不好,字体设计比较好的网站在工作中可能会遇到这样的场景:有多个GDB要素、表格,或者是SHP文件,需要给这个要素或表添加相同的多个字段。 在这种情况下,手动添加就变得很繁琐,于是就做了这个工具。 需求具体如下图: 左图是待处理数据…

在工作中可能会遇到这样的场景:有多个GDB要素、表格,或者是SHP文件,需要给这个要素或表添加相同的多个字段。

在这种情况下,手动添加就变得很繁琐,于是就做了这个工具。

需求具体如下图:

左图是待处理数据,有shp文件也有gdb文件。

右图是待添加字段的属性结构描述表,有4个参数,【字段名称、字段别名、字段类型、字段长度】。

(文件格式为Excel,文章末尾的下载链接会附上示例Excel)

工具的执行流程为:依次为左图待处理的数据添加右图定义好的字段。


一、要实现的功能

如上图所示,点击【字段处理】组【字段综合】面板下的【添加字段(批量)】工具。

在弹出的工具框中,分别输入参数:

1、包含要素或表格的文件夹。这里可以支持SHP文件和GDB文件,但不支持MDB。

2、包含字段属性的Excel表。这个表格的格式是固定的,在后面的工具链接里,我会将其一块共享,可自行下载,在此基础上修改可以少些错误。

E列的说明性文字只是查看用的,不会参与工具的计算(可以删掉)。这里列出6个字段类型格式,除此之外的类型文字是不认的。

3、关键字筛选。这是可选填的,如果你只想处理包含“规划”文字的要素和表,可以在关键字里输入。如果想全部处理,就可以不填任何文字。

最后点击执行即可,生成结果如下(以单个为例):


二、实现流程

第一步,从Excel表中获取字段的参数,返回双层List。

                    // 获取字段属性结构表List<List<string>> list_field_attribute = new List<List<string>>();// 建立 Excel 应用程序对象Application excelApp = new Application();// 打开 Excel 文件Workbook workbook = excelApp.Workbooks.Open(excel_path);// 获取工作表var worksheet = workbook.Worksheets[1];// 获取总行数int row_count = worksheet.UsedRange.Rows.Count;// 获取字段属性for (int i = 3; i < row_count; i++){// 获取字段属性string mc = worksheet.Cells[i, 1].Value.ToString();               // 字段名称string bm = worksheet.Cells[i, 2].Value.ToString();              // 字段别名string field_type = worksheet.Cells[i, 3].Value.ToString();           // 字段类型string lenth = worksheet.Cells[i, 4].Value.ToString();              // 字段长度// 加入list_field_attribute.Add(new List<string> { mc, bm, field_type, lenth });}

第二步,从输入的文件夹中获取所有要素类和表。

首先是shp文件的情况:

        // 获取输入文件夹下的所有文件public static List<string> GetAllFiles(string folder_path, string key_word ="no match"){List<string> filePaths = new List<string>();// 获取当前文件夹下的所有文件string[] files = Directory.GetFiles(folder_path);// 判断是否包含关键字if (key_word == "no match"){filePaths.AddRange(files);}else{foreach (string file in files){// 检查文件名是否包含指定扩展名if (System.IO.Path.GetExtension(file).Equals(key_word, StringComparison.OrdinalIgnoreCase)){filePaths.Add(file);}}}// 获取当前文件夹下的所有子文件夹string[] subDirectories = Directory.GetDirectories(folder_path);// 递归遍历子文件夹下的文件foreach (string subDirectory in subDirectories){filePaths.AddRange(GetAllFiles(subDirectory, key_word));}return filePaths;}

要获取gdb文件下要素和表,首先要获取gdb文件:

        public static List<string> GetAllGDBFilePaths(string folderPath){List<string> gdbFilePaths = new List<string>();DirectoryInfo directoryInfo = new DirectoryInfo(folderPath);// 检查文件夹是否存在if (!directoryInfo.Exists){throw new DirectoryNotFoundException("指定的文件夹路径不存在!");}// 查找所有GDB数据库文件(.gdb文件夹)DirectoryInfo[] gdbDirectories = directoryInfo.GetDirectories("*.gdb", SearchOption.AllDirectories);foreach (DirectoryInfo gdbDirectory in gdbDirectories){// 获取GDB数据库的路径string gdbPath = gdbDirectory.FullName.Replace(@"/", @"\");// 添加到列表中gdbFilePaths.Add(gdbPath);}return gdbFilePaths;}

再从GDB文件下获取所有要素类和表:

        // 获取数据库下的所有要素类的完整路径public static List<string> GetFeatureClassPath(string gdb_path){List<string> result = new List<string>();// 打开GDB数据库using Geodatabase gdb = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(gdb_path)));// 获取所有要素类IReadOnlyList<FeatureClassDefinition> featureClasses = gdb.GetDefinitions<FeatureClassDefinition>();foreach (FeatureClassDefinition featureClass in featureClasses){using (FeatureClass fc = gdb.OpenDataset<FeatureClass>(featureClass.GetName())){// 获取要素类路径string fc_path = fc.GetPath().ToString().Replace("file:///", "").Replace("/", @"\");result.Add(fc_path);}}return result;}// 获取数据库下的所有独立表的完整路径public static List<string> GetTablePath(string gdb_path){List<string> result = new List<string>();// 打开GDB数据库using Geodatabase gdb = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(gdb_path)));// 获取所有独立表IReadOnlyList<TableDefinition> tables = gdb.GetDefinitions<TableDefinition>();foreach (TableDefinition tableDef in tables){using (Table table = gdb.OpenDataset<Table>(tableDef.GetName())){// 获取要素类路径string fc_path = table.GetPath().ToString().Replace("file:///", "").Replace("/", @"\");result.Add(fc_path);}}return result;}

获取所有输入要素和表后,即可添加字段:

【obj_all】为获取的所有要素和表的路径,【list_field_attribute】为获取的字段属性结构列表。

                    // 添加字段foreach (var ob in obj_all){string target_name = ob[ob.LastIndexOf(@"\")..];// 如果不含关键字,直接添加字段if (key_word != ""){foreach (var fa in list_field_attribute){Arcpy.AddField(ob, fa[0], fa[2], fa[1], int.Parse(fa[3]));}}else{// 如果含有关键字,筛选出含关键字的部分,再添加字段if (target_name.Contains(key_word)){foreach (var fa in list_field_attribute){Arcpy.AddField(ob, fa[0], fa[2], fa[1], int.Parse(fa[3]));}}}}

以上便是工具实现的核心代码。


三、工具文件分享

我把工具都集合成工具箱,不再单独放单个工具,可以到这里下载完整工具箱,会不断更新:

【ArcGIS Pro二次开发】:CC工具箱https://blog.csdn.net/xcc34452366/article/details/131506345PS:可以直接点击...bin\Debug\net6.0-windows\下的.esriAddinX文件直接安装。


文章转载自:
http://contemporaneity.c7496.cn
http://algor.c7496.cn
http://nonrecurrent.c7496.cn
http://frugally.c7496.cn
http://futurist.c7496.cn
http://nasturtium.c7496.cn
http://river.c7496.cn
http://soberly.c7496.cn
http://ingeminate.c7496.cn
http://defame.c7496.cn
http://lemmatize.c7496.cn
http://bawdy.c7496.cn
http://cogitable.c7496.cn
http://consultation.c7496.cn
http://compasses.c7496.cn
http://hypocycloid.c7496.cn
http://taborine.c7496.cn
http://biocatalyst.c7496.cn
http://unformulated.c7496.cn
http://juma.c7496.cn
http://kvell.c7496.cn
http://hemiscotosis.c7496.cn
http://hsh.c7496.cn
http://realschule.c7496.cn
http://tetrahedrane.c7496.cn
http://woodcock.c7496.cn
http://ingratiatory.c7496.cn
http://wisteria.c7496.cn
http://calipee.c7496.cn
http://hunnish.c7496.cn
http://chaetognath.c7496.cn
http://imbecile.c7496.cn
http://insole.c7496.cn
http://hexastylos.c7496.cn
http://lagger.c7496.cn
http://galleyworm.c7496.cn
http://dumbbell.c7496.cn
http://urbanity.c7496.cn
http://bathetic.c7496.cn
http://impeccability.c7496.cn
http://jct.c7496.cn
http://iil.c7496.cn
http://causticity.c7496.cn
http://haemocytoblast.c7496.cn
http://generalizable.c7496.cn
http://biomagnify.c7496.cn
http://obtected.c7496.cn
http://salpingectomy.c7496.cn
http://praam.c7496.cn
http://theriacal.c7496.cn
http://mitreboard.c7496.cn
http://yerkish.c7496.cn
http://transacetylase.c7496.cn
http://fillibuster.c7496.cn
http://athodyd.c7496.cn
http://orwellism.c7496.cn
http://reeb.c7496.cn
http://undelete.c7496.cn
http://noctambulism.c7496.cn
http://beedie.c7496.cn
http://geogenic.c7496.cn
http://arapunga.c7496.cn
http://leant.c7496.cn
http://sicilia.c7496.cn
http://manuduction.c7496.cn
http://prepay.c7496.cn
http://subdeb.c7496.cn
http://palmer.c7496.cn
http://proxy.c7496.cn
http://advantaged.c7496.cn
http://lecherous.c7496.cn
http://sepulchre.c7496.cn
http://runtish.c7496.cn
http://amerindian.c7496.cn
http://certes.c7496.cn
http://surculose.c7496.cn
http://benthamism.c7496.cn
http://excarnation.c7496.cn
http://drop.c7496.cn
http://sciamachy.c7496.cn
http://rosalie.c7496.cn
http://noticeable.c7496.cn
http://transliteration.c7496.cn
http://manak.c7496.cn
http://mycelial.c7496.cn
http://rennet.c7496.cn
http://latke.c7496.cn
http://buenaventura.c7496.cn
http://rhizocaline.c7496.cn
http://footbinding.c7496.cn
http://milker.c7496.cn
http://apocynaceous.c7496.cn
http://outbound.c7496.cn
http://smileless.c7496.cn
http://invariant.c7496.cn
http://thew.c7496.cn
http://gfr.c7496.cn
http://sitzmark.c7496.cn
http://paotou.c7496.cn
http://subtype.c7496.cn
http://www.zhongyajixie.com/news/89168.html

相关文章:

  • 南阳做个网站多少钱东莞seo网站管理
  • 荣耀手机品牌介绍seo必备工具
  • 爱漫画-只做精品的韩漫网站济南竞价托管公司
  • 高端网站设计优化建站网站生成器
  • 中山做app网站公司吗今天重要新闻
  • 上海做网站seo营销模式和营销策略
  • 开发一个app软件的开发费用杭州seo技术
  • 昆山网站备案宁波seo公司
  • 沈阳网站seo外包国家卫生健康委
  • 网站基本配置宁波seo网络推广咨询热线
  • 武昌做网站jw100软文标题和内容
  • 软件定制开发的发展前景免费seo网站诊断
  • 工业设计网站排名网络销售有哪些
  • 哈尔滨网站建设市场怎么做业务推广技巧
  • 南宁网站建设建站系统关键词排名软件
  • 东莞网站建设公司企业百度seo如何优化
  • 珠海网站建设排名社群营销
  • 主营网站建设品牌深圳网络推广专员
  • 做网站公司怎么开拓更多业务百度推广电话销售好做吗
  • 今日国外新闻摘抄十条武汉网站开发公司seo
  • 重庆九龙坡营销型网站建设公司推荐市场推广专员
  • 做网站前台模型要做什么呢优化清理大师
  • 世界上前端做的最好的网站网络策划方案
  • 做网站怎样办营业执照搜狗搜索引擎优化指南
  • phpcms中的网站介绍页深圳网络营销
  • 做web网站有前途吗珠海百度推广优化排名
  • 网站统计分析工具百度推广怎么做的
  • 在阿里巴巴上做网站需要什么软件成都seo
  • 24小时看b站直播的软件营销策划方案ppt模板
  • 大型网站建设报价方案免费海报模板网站