如何在matplotlib底图中迭代多边形

时间:2015-11-30 06:40:53

标签: python matplotlib gis shapefile matplotlib-basemap

我有一个带有省多边形的shapefile用于中国。中国有31个省,我的形状文件'我在Excel中打开它们时,.csv和.dbf文件都包含31行。

但是,当我尝试使用以下代码迭代它们时,我会重复多次省份(显然有不同的多边形坐标)。那是为什么?

m = Basemap(projection='merc',llcrnrlat=15,urcrnrlat=55,llcrnrlon=70,urcrnrlon=140,lat_ts=20,resolution='c')
    shp = m.readshapefile(china_shapefile, 'states', drawbounds=True)


for info, shape in zip(m.states_info, m.states):
    print info["NAME_1"]#NAME_1 is the province name in english 
    print shape[0]#First coordinate of the polygon to quickly check if they are repeated

0 个答案:

没有答案
相关问题