zoukankan      html  css  js  c++  java
  • ArcGIS应用——使用Python为图斑连续编号及扩展应用

    为图斑连续编号

    在GIS应用中,为图斑连续编号(编号递增)是一项常见的需求,利用ArcGIS,可以方便的实现。

    Python脚本如下:

    rec=0
    def autoIncrement():
     global rec
     pStart = 1 #adjust start value, if req'd 
     pInterval = 1 #adjust interval value, if req'd
     if (rec == 0): 
      rec = pStart 
     else: 
      rec = rec + pInterval 
     return rec
    autoIncrement()

    如此可得到从1递增的编号序列。

    扩展应用——连续编号并右对齐格式(左边空缺补0)

    Python脚本如下:

    rec=0
    def autoIncrement():
     global rec
     pStart = 1 #adjust start value, if req'd 
     pInterval = 1 #adjust interval value, if req'd
     if (rec == 0): 
      rec = pStart 
     else: 
      rec = rec + pInterval 
     return rec
    (str(autoIncrement())).zfill(5)

     如此可得到一个长度为5个字符的值,右对齐格式,左侧空缺补0

    举一反三,可以得到更多的效果,完成更复杂的需求。

  • 相关阅读:
    Html中常用的属性
    vue-页面回退
    vue-watch
    html
    Html-列表
    vue项目中px自动转换为rem
    vuex使用
    localStorage的使用
    slot
    模糊查询
  • 原文地址:https://www.cnblogs.com/hans_gis/p/3765875.html
Copyright © 2011-2022 走看看