python - arcgisimage、 basemap python 的更好文档

标签 python matplotlib-basemap

我正在使用 arcgisimage API 将 map 图层添加到我的散点图中。

但是,可以在此处找到 API 文档 http://basemaptutorial.readthedocs.org/en/latest/backgrounds.html不太好,特别是关于图像的大小:

xpixels actually sets the zoom of the image. A bigger number will ask a bigger image, so the image will have more detail. So when the zoom is bigger, the xsize must be bigger to maintain the resolution

dpi is the image resolution at the output device. Changing its value will change the number of pixels, but not the zoom level

提到的 xsize 没有在任何地方定义,并且将 DPI 在 300 到 600 之间加倍不会影响图像的大小。

有人有更好的文档/教程吗?

最佳答案

我正在学习一些类似的事情......而且我对此很陌生。所以我能做的就是提出一些我心中简单的想法。希望这对你有帮助。(虽然看起来不太可能。^_^) 以下代码来自教程的给定示例,并添加了一些调整。 (以洛杉矶为中心)

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

    map = Basemap(llcrnrlon=-118.5,llcrnrlat=33.15,urcrnrlon=-117.15,urcrnrlat=34.5, epsg=4269)
    #http://server.arcgisonline.com/arcgis/rest/services
    #EPSG Number of America is 4269

    map.arcgisimage(service='World_Physical_Map', xpixels = 1500, verbose= True)
    plt.show()

首先,我猜这里“xsize”等于“xpixels”,或者应该是“size”(拼写错误?我不确定)。正如教程中所述,“xpixel”影响的是最终图形的分辨率及其大小。

xpixels=150时,您将得到以下图片(约206KB): 206KB 但是,当xpixels=1500时,您将获得更高分辨率的图片(约278KB)。而且当你放大看细节时,这张图片比前一张更清晰。 273KB

如果你想用更大的变焦看图片,你需要将“xpixels”设置为更大的值以保持清晰。(也就是保持分辨率。我猜他们只是给出了一些简单的解释,没有太多详细信息。)而且我不知道“dpi”是用来做什么的……就像第一次把蛋糕切成300个网格,然后第二次把它切成600个网格。这个数字不会更清楚。从你的说法我知道它也不会变成更大的图表。

关于python - arcgisimage、 basemap python 的更好文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31549963/

相关文章:

python - 使用 matplotlib basemap 绘制 .tif GDAL 栅格

python - 将 Pandas 数据框重组为 basemap 的网格

python - 在 Pillow 中打开和加载图像时出现 "Too many open files"错误

python - 更新现有表/模型列/字段?

python - Perforce (P4) Python API 提示锁太多

python - 如果在 for 循环中不工作,即使条件满足

python - 使用 Mechanize 修改表单

python - 停止 contourf 插值

python - 不均匀(曲线)网格的 Matplotlib 流图

python - 如何让 Basemap 与时间片的 xarray 绘图一起使用