python 2.7导入arcpy_python2.7,arcpy:将txt文件中的数据导入空属性表。

我有一个shapefile(Fireincidents)当前没有任何数据。我想用文本文件中的数据填充特性(北美火灾)。文本文件包含每个火的lat、long和confidence。我创建了一个新的插入光标来插入新角色。我还启动了一个for循环来遍历文本文件中的每一行。我很难确定一个方法来填充point类对象中的行。我认为我必须创建一个列表,将文本文件中的数据附加到该列表中,然后以某种方式将该数据列表插入属性表中。在

我的当前代码:try:

work = raw_input("Enter the full path of WildlandFires.mdb: ")

arcpy.env.workspace = work

arcpy.env.overwriteOutput = True

iFile = raw_input("Enter the full path of wildfire text file: ")

fields = ["SHAPE@", "CONFIDENCEVALUE"]

cur = arcpy.da.InsertCursor("FireIncidents", fields)

f = open(iFile, 'r')

lstFires = f.readlines()

cntr = 0

for fire in lstFires:

if 'Latitude' in fire:

continue

row = line.split(',')

lstValues = []

latitude = row[0].strip()

longitude = row[1].strip()

confid = row[2].strip()

pnt = arcpy.CreateObject("Point")

lstValues.append(pnt)

f.close()

except Exception as e:

print "Error: " + str(e)

print arcpy.GetMessages()

arcpy.AddError(e)

如有任何指导,我们将不胜感激。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值