我是靠谱客的博主 淡淡钢笔,最近开发中收集的这篇文章主要介绍ArcGIS Pro脚本工具(16)——要素类转txt坐标文件,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

之前介绍过txt坐标文件如何转为GIS要素类

ArcGIS Pro脚本工具(8)——txt坐标文件转shp_学学GIS的博客-CSDN博客_txt转shp国土部门给过来的数据经常需要转换,比如土地报批和高标准农田的数据经常给一个txt文件过来,不能直接在GIS软件中使用。这些txt文件结构通常如下。如果txt文件的数据量小,那么在Excel中预处理再在ArcGIS中使用工具生成面还算简单。如果面的个数很多,那用Excel预处理这一步就很繁琐了。之前已经接触过Python以及ArcPy,估计可以使用编程的方法解决。在一番面向百度编程之后,终于找到一个堪称完美的解决办法。在此也感谢一下趟水的前辈。arcgis 经纬度转大地坐标_土地报备坐标txthttps://blog.csdn.net/baidu_28157641/article/details/122811245网友反馈希望做一个相反功能的工具,也就是从要素类转为txt坐标文件,虽然自己的工作基本没碰到这个需求,不过还是尝试制作了一下。

下面演示将变更数据内的几块用地转为txt坐标文件。

工具演示

工具参数

 参数验证

class ToolValidator:
  # Class to add custom behavior and properties to the tool and tool parameters.

    def __init__(self):
        # set self.params for use in other function
        self.params = arcpy.GetParameterInfo()

    def initializeParameters(self):
        # Customize parameter properties. 
        # This gets called when the tool is opened.
        return

    def updateParameters(self):
        # Modify parameter values and properties.
        # This gets called each time a parameter is modified, before 
        # standard validation.
        txtPath = self.params[1].valueAsText
        suffix = ".txt"
        if txtPath.endswith(suffix)==False:
            self.params[1].value=txtPath+".txt"
        return

    def updateMessages(self):
        # Customize messages for the parameters.
        # This gets called after standard validation.
        return

    # def isLicensed(self):
    #     # set tool isLicensed.
    # return True

    # def postExecute(self):
    #     # This method takes place after outputs are processed and
    #     # added to the display.
    # return

工具说明

  1. 要素类需要拆分多部件后再使用工具转txt
  2. 图形的点数默认包含在输出txt文件的要素属性行中的第一个
  3. 工具界面输出字段的顺序与输出txt文件中要素属性行的属性顺序一致

工具下载

        请私信联系。

最后

以上就是淡淡钢笔为你收集整理的ArcGIS Pro脚本工具(16)——要素类转txt坐标文件的全部内容,希望文章能够帮你解决ArcGIS Pro脚本工具(16)——要素类转txt坐标文件所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(49)

评论列表共有 0 条评论

立即
投稿
返回
顶部