Python底图:获取更详细的海岸线图

Python Basemap: getting more detailed coastline drawing

有没有办法获得比Basemap中默认的更详细的海岸线?例如,如果我尝试显示挪威的海岸,默认的绘图非常粗糙且有点难看(见图)。有什么办法可以得到更好的海岸线/控制海岸线分辨率?

代码:

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np

# setup Lambert Conformal basemap.
m = Basemap(llcrnrlon=-8.0, llcrnrlat=55.5, urcrnrlon=34.5, urcrnrlat=72.0,
            lat_0="65.0", lon_0=15.0,
            projection="lcc")

# draw coastlines.
m.drawcoastlines()

# draw a boundary around the map, fill the background.
# this background will end up being the ocean color, since
# the continents will be drawn on top.
m.drawmapboundary(fill_color="#A6CAE0")

# fill continents, set lake color.
m.fillcontinents(color='grey',lake_color='lavender')

# draw parallels and meridians.
# label parallels on right and top
# meridians on bottom and left
parallels = np.arange(50.,75.,10.)
# labels = [left,right,top,bottom]
m.drawparallels(parallels,labels=[False,True,True,False])
meridians = np.arange(-10.,40,10.)
m.drawmeridians(meridians,labels=[True,False,False,True])

plt.show()

生产:

解决方案:

非常感谢@hemmelig 的解决方案:)

更改为:

# setup Lambert Conformal basemap.
m = Basemap(llcrnrlon=-8.0, llcrnrlat=55.5, urcrnrlon=34.5, urcrnrlat=72.0,
            lat_0="65.0", lon_0=15.0,
            projection="lcc",
            resolution="l")

生成更好的地图:

实例化底图时使用 resolution 关键字。

可以是 c(原油)、l(低)、i(中级)、h(高)、f(完整) 或 None。如果 None,则不会读入任何边界数据(并且 class 方法(例如 drawcoastlines 将引发 if 调用)。数据集之间的分辨率下降了大约 80%。高分辨率数据集的绘制速度要慢得多。 默认 c。海岸线数据来自 GSHHS (http://www.soest.hawaii.edu/wessel/gshhs/gshhs.html). State, country and river datasets from the Generic Mapping Tools (http://gmt.soest.hawaii.edu)。 (来自文档)