python 城市地图_使用底图获取城市地图的最佳方法? - python

我正在尝试使用Basemap在python中显示城市的地图,例如旧金山。我尝试了以下方法:

from mpl_toolkits.basemap import Basemap

import numpy as np

import matplotlib.pyplot as plt

# llcrnrlat,llcrnrlon,urcrnrlat,urcrnrlon

# are the lat/lon values of the lower left and upper right corners

# of the map.

# lat_ts is the latitude of true scale.

# resolution = 'c' means use crude resolution coastlines.

m = Basemap(projection='merc',llcrnrlat=37.79,urcrnrlat=37.81,\

llcrnrlon=-122.42,urcrnrlon=-122.4,lat_ts=20,resolution='c')

m.drawcoastlines()

m.fillcontinents(color='coral',lake_color='aqua')

# draw parallels and meridians.

m.drawparallels(np.arange(-90.,91.,30.))

m.drawmeridians(np.arange(-180.,181.,60.))

m.drawmapboundary(fill_color='aqua')

plt.title("Mercator Projection")

plt.show()

但是,这不起作用,只会在地图应显示的位置显示蓝色。那么如何使用python获取旧金山的地图呢?

参考方案

您的座标一定是错误的:它显示为蓝色,因为您正在放大某处的海洋。

此外,此代码只会绘制海岸线as explained in the documentation。要获取城市的地图,您实际上需要使用可用的后端之一加载相应的数据。例如,您可以从API服务(例如ArcGIS等,with the corresponding method)查询数据。

Matplotlib'粗体'字体 - python

跟随this example:import numpy as np import matplotlib.pyplot as plt fig = plt.figure() for i, label in enumerate(('A', 'B', 'C', 'D')): ax = f…matplotlib:使加号变粗 - python

在Matplotlib中,我想绘制一个粗体加号(或一个十字),但是marker set中提供的那个太 thin 。即使增加它的大小,它也不会变厚。对于example:绘制红色加号的lines of code是:# Draw median marker. if plot_opts.get('bean_show_median', True):…在返回'Response'(Python)中传递多个参数 - python

我在Angular工作,正在使用Http请求和响应。是否可以在“响应”中发送多个参数。角度文件:this.http.get("api/agent/applicationaware").subscribe((data:any)... python文件:def get(request): ... return Response(seriali…Python exchangelib在子文件夹中读取邮件 - python

我想从Outlook邮箱的子文件夹中读取邮件。Inbox ├──myfolder 我可以使用account.inbox.all()阅读收件箱,但我想阅读myfolder中的邮件我尝试了此页面folder部分中的内容,但无法正确完成https://pypi.python.org/pypi/exchangelib/ 参考方案 您需要首先掌握Folder的myfo…python JSON对象必须是str,bytes或bytearray,而不是'dict - python

在Python 3中,要加载以前保存的json,如下所示:json.dumps(dictionary)输出是这样的{"('Hello',)": 6, "('Hi',)": 5}当我使用json.loads({"('Hello',)": 6,…

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值