2014-04-13 140 views
0

我正在使用Pyshp从shapefile中提取信息。使用的shapefile.Reader()程序,我能够得到以下的输出:使用Python从shapefile中提取信息

[('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 [:]。shape.points [:]的行,但我一直花费数小时试图找出确切的语法。

任何帮助将是伟大的!

回答

0

我是能够通过使用底图(它使用Pyshp)来解决这个问题:

val = [] 
    s = m.readshapefile('last_500','last_500') 
    for shapedict in m.last_500_info: 
     val.append(shapedict['fieldname']) 
    print val