使用Python从Shapefile中提取信息
-
21-12-2019 - |
题
我正在使用pyshp从shapefile中提取信息。使用shapefile.reader()程序,我可以获得以下输出:
[('DeletionFlag', 'C', 1, 0), ['Id', 'N', 11, 0], ['Hrapx', 'N', 6, 0], ['Hrapy','N', 6, 0], ['Lat', 'N', 7, 4], ['Lon', 'N', 9, 4], ['Globvalue', 'N', 16, 2]]
.
如何提取列表中最后一个索引的值的所有(即,'globvalue')。
这应该很容易提取lat和lon字段太右呢?
我假设它是沿着点线的东西= shaperecs [:]。shove.points [:]但我一直在花费时间试图弄清楚确切的语法。
任何帮助都会很棒!
解决方案
我能够通过使用asbemap(使用pyshp)来解决这个问题:
val = []
s = m.readshapefile('last_500','last_500')
for shapedict in m.last_500_info:
val.append(shapedict['fieldname'])
print val
. 不隶属于 StackOverflow