- 积分
- 2262
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-10-8
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我用cartopy.io.shapereader读取SHP文件时出错代码:
def create_map():
shp_path = r'/home/ymx/文档/pythonref/shp/Jiangsu_city/'
# 创建画图空间
proj = ccrs.PlateCarree()
fig = plt.figure()
ax = fig.subplots(1, 1, subplot_kw={'projection': proj})
# 设置地图属性
reader = Reader(shp_path + 'jiangsu_city.shp')
feature = cfeat.ShapelyFeature(reader.geometries(),
proj,
edgecolor='k',
facecolor='none')
ax.add_feature(feature, linewidth=1)
extent = [116, 122.5, 30.5, 35.5]
ax.set_extent(extent, crs=proj)
# set figure ticks
ax.set_xticks(np.arange(116,122+1,1))
ax.set_yticks(np.arange(30.5,35.5+0.5,0.5))
# set figure ticks formatter
ax.xaxis.set_major_formatter(LONGITUDE_FORMATTER)
ax.yaxis.set_major_formatter(LATITUDE_FORMATTER)
# set figure minor locator
ax.xaxis.set_minor_locator(plt.MultipleLocator(0.5))
#ax.yaxis.set_minor_locator(plt.MultipleLocator(5))
return fig, ax
fig, ax = create_map()
出现错误
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 0: invalid start byte
求帮忙解决
|
|