【问题标题】:Plot google map as background将谷歌地图绘制为背景
【发布时间】:2017-01-06 21:55:49
【问题描述】:

我想显示谷歌地图,我使用这个代码:

url = "http://maps.googleapis.com/maps/api/staticmap?center=-30.027489,-51.229248&size=800x800&zoom=14&sensor=false"
im = Image.open(cStringIO.StringIO(urllib2.urlopen(url).read()))
plt.imshow(im)
plt.show()

这给了我:

我不明白

【问题讨论】:

    标签: python image google-maps url


    【解决方案1】:

    查看documentation of imshow(),特别是它的origin 参数,该参数确定数组的[0,0] 索引在图中的位置。

    该行需要是:

    plt.imshow(im, origin='upper')
    

    【讨论】:

      猜你喜欢
      • 2012-11-28
      • 1970-01-01
      • 1970-01-01
      • 2015-10-17
      • 2012-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多