我可以在一个shapefile中搜索一个属性,它工作得很好,但我不知道在找到正确的记录后如何获取该记录中的其他字段。不知道我应该使用SearchCursor还是SelectLayerByAttribute_管理
townlands = r'F:\MyProject\Assignment\townlands.shp'
outpath = r'F:\MyProject\Assignment'
the_townland=str(text_search_townland.get())
selection = str(""" "NAME_TAG" = '""" + the_townland + "'")
selection2 = ????????????????
print selection, selection2
这段代码的工作原理是,它查找用户输入文本\u search\u townland的城镇,并将其打印为选择。我希望从该记录中获取另一个名为OSM_USER的字段,并将其输入selection2
经过多次尝试和错误后,我终于成功了。它确实需要SearchCursor,至少我是这样让它工作的
希望这对别人有帮助
相关问题 更多 >
编程相关推荐