ARCGIS中根据字段属性重新排序并自动编号的方法

import arcpy 
... 
... rows = arcpy.UpdateCursor("河道面_split_attributes","","","","sectionN A")
... 
... i=1
... 
... for row in rows:
... 
...      row.num=i
... 
...      i=i+1
... 
...      rows.updateRow(row)
... 
... del rows
... 
... del row
import arcpy 
cur=arcpy.UpdateCursor("河道面_split_attributes","","","","sectionN A")
... 
... i=0
... 
... for row in cur:
... 
...   row.num=i
... 
...   cur.updateRow(row)
... 
... del  cur,row
... 
... print "success"
... 

在ArcGIS属性表中根据某一字段进行分组编号

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

你可能感兴趣的:(arcgis)