- 积分
- 2979
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-12-8
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 锦叶seven 于 2021-1-13 23:49 编辑
求教!!!利用basemap画地图,已经设置了边界以及中心经纬度,但却画出来这样子……
这是代码,求大佬指教!
m = Basemap(projection='cyl',resolution='i',llcrnrlon=110,llcrnrlat=21,urcrnrlon=112,urcrnrlat=23,lat_0 =22, lon_0 = 111)fig, ax = plt.subplots(figsize=(16,9))
shp_info3 = m.readshapefile('D:\Data\map_file\CHN_adm_shp\CHN_adm3','states',drawbounds=False,linewidth = 0.4,zorder=10)
for info, shp in zip(m.states_info, m.states):
proid = info['NAME_2'] # 可以用notepad打开CHN_adm1.csv文件,可以知道'NAME_1'代表各省的名称
if proid == 'Maoming':
poly = Polygon(shp,facecolor='None',edgecolor='b', lw=0.8)
ax.add_patch(poly)
else:
poly = Polygon(shp,facecolor='w',edgecolor='w', lw=0.8)
ax.add_patch(poly)
#市一级底图
shp_info2 = m.readshapefile('D:\Data\map_file\CHN_adm_shp\CHN_adm2','states',drawbounds=False,linewidth = 0.4,zorder=10)
for info, shp in zip(m.states_info, m.states):
proid = info['NAME_2']
if proid == 'Maoming':
poly = Polygon(shp,facecolor='None',edgecolor='black', lw=0.8)
ax.add_patch(poly)
|
-
|