ArcGIS10.1 python 提取面的所有拐点坐标到属性字段中
2013-04-08 14:33
369 查看
也许你会有这样的需求,是要把面数据的所有拐点坐标提取出来存储到一个属性字段中使用,但是又不想大费周折的写一些AO、AE甚至是addin的程序,那么你可以选择是哟个python来完成你的工作。示例代码如下,在arcgis10.1中通过测试
def MySub(feat):
partnum = 0
#multipart feature
partcount = feat.partCount
pntcount = 0
str=''
# Enter while loop for each part in the feature (if a singlepart feature
# this will occur only once)
while partnum < partcount:
part = feat.getPart(partnum)
pnt = part.next()
# Enter while loop for each vertex
#
str=str+"["
while pnt:
pntcount += 1
px='%f' %pnt.x
py='%f' %pnt.y
str=str+px+","+py +";"
pnt = part.next()
# If pnt is null, either the part is finished or there is an
# interior ring
if not pnt:
str=str[:-1]
str=str+"]"
pnt = part.next()
partnum += 1
return str
def MySub(feat):
partnum = 0
#multipart feature
partcount = feat.partCount
pntcount = 0
str=''
# Enter while loop for each part in the feature (if a singlepart feature
# this will occur only once)
while partnum < partcount:
part = feat.getPart(partnum)
pnt = part.next()
# Enter while loop for each vertex
#
str=str+"["
while pnt:
pntcount += 1
px='%f' %pnt.x
py='%f' %pnt.y
str=str+px+","+py +";"
pnt = part.next()
# If pnt is null, either the part is finished or there is an
# interior ring
if not pnt:
str=str[:-1]
str=str+"]"
pnt = part.next()
partnum += 1
return str
相关文章推荐
- ARCGIS中Python实现按属性字段批量掩膜提取
- 字段计算器通过python脚本完成要素节点坐标信息提取到属性字段中
- 字段计算器通过python脚本完成要素节点坐标信息提取到属性字段中
- C#通过反射获取对象属性,打印所有字段属性的值
- python查询数据库所有表名和字段,使用SQLAlchemy查询所有表名
- Mongodb的亿万级数据集合中提取字段的所有不同值集合
- ArcMap中用python的split方法提取字段的值
- Python 继承、多重继承、多态、isinstance判断类型、type()获取变量类型、dir()获取变量的所有属性
- SQL批量删除指定数据表中的所有字段说明属性
- python遍历字典所有的字段
- ArcGIS按字段属性分割文件
- ArcGIS属性编辑字符型字段值出现乱码问题
- Google Python Class 之——正则表达式提取html网页数据字段
- python + opencv 中 kp(关键点) 的形式及提取坐标方法
- python 打印出所有的对象/模块的属性(实例代码)
- 在arcgis使用python脚本进行字段计算时是如何解决中文问题的
- PYTHON-arcgis的开发:批量操作字段
- SQL批量删除指定数据表中的所有字段说明属性
- -------------------获取当前数据库所有表的外键创建脚本、获取指定表的创建脚本,包括表和字段的属性、外键-----------------------
- beautifulsoup提取所有<a>标签内容 Python