我有一个列表“shapelist
”,其中有许多要使用的目录。
这个循环有很多函数,在这个过程中,我必须添加另一个循环,将坐标系分配给一些文件。正确的方法是什么?你知道吗
#This is the initial loop
for i in shapelist:
arcpy.FeatureToLine_management([i] ,i.replace('ASTENOT.shp', 'ASTENOT_lines'))
#many more lines with functions
#at some point I have to add coordinate system information to exported files
#how do I do that in this loop without creating perplexing results?
我想在某个地方加上这段代码,用来指定坐标系。你知道吗
#Finds and stores to a list the files that need the coordinate system assignment
rootfolder = r'C:\Users\user\Desktop\etg'
import os
newlist = []
for path, subdirs, files in os.walk(rootfolder):
for name in files:
if name==('centerline.shp'):
newlist.append(os.path.join(path, name))
newlist
现在包含需要坐标系赋值的文件
#follows the loop that does the assignment
for i in newlist:
... sr = arcpy.SpatialReference(2100)
... arcpy.DefineProjection_management(i, sr)
如何将所有这些添加到初始循环中?你知道吗
由于在没有输入数据和预期输出的情况下很难测试问题的解决方案,而且我从未使用过ArcGIS,因此我只能推测您想做什么:
这看起来像是你想做的吗?如果不是,你就得更好地解释你想做什么。你知道吗
相关问题 更多 >
编程相关推荐