为图斑连续编号

在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

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

最新文章

  1. Android Studio 编译单个module
  2. react native 之子组件和父组件之间的通信
  3. 解决ubuntu下安装mysql使用service无法启动问题
  4. [LeetCode]题解(python):030-Substring with Concatenation of All Words
  5. 算法设计手冊(第2版)读书笔记, Springer - The Algorithm Design Manual, 2ed Steven S.Skiena 2008
  6. 静态代码检查工具 cppcheck 的使用(可分别集成到VS和QT Creator里)
  7. Linux 环境下java安装及配置
  8. NemaStudio船舶模拟软件下载及破解
  9. static class 静态类(Java)
  10. Iterator 和 ListIterator 的不同点以及包含的方法
  11. 常用的三种json软件的使用
  12. Autotools知识点
  13. 第四百一十四节,python常用算法学习
  14. vue中的数据双向绑定
  15. 移动端图片轮播—swipe滑动插件
  16. angualrJS(mvc)指令嵌套使用的一些问题
  17. jsp table td自动换行
  18. pandas DataFrame的查询方法(loc,iloc,at,iat,ix的用法和区别)
  19. 2017-02-20 Sql Server2016安装后无法找到Microsoft Sql Server Management Studio管理器
  20. POJ 3714 分治/求平面最近点对

热门文章

  1. c#中如何获取本机用户名、MAC地址、IP地址、硬盘ID、CPU序列号、系统名称、物理内存
  2. BDE View not exists
  3. innobackupex 备份数据搭建 MySQL Slave
  4. Python nonlocal 与 global 关键字解析
  5. bootstrap 的页码显示问题-------------德州
  6. zt对于C#中的FileUpload解决文件上传大小限制的问题设置
  7. Spark-Mllib中各分类算法的java实现(简易教程)
  8. beego 自定义模板函数
  9. 【UVA1515 算法竞赛入门指南】 水塘【最小割】
  10. dll函数生成规则