按照安装OSMnx(包括显式安装 spatialindex
)的说明进行操作后
brew install spatialindex
pip install osmnx
运行第一个基本的例子
import osmnx as ox
G = ox.graph_from_place('Manhattan Island, New York City, New York, USA', network_type='drive')
ox.plot_graph(ox.project_graph(G))
在项目的readme中,我明白了
Traceback (most recent call last):
File "/Users/Rax/Documents/Projects/Coding/Python/maps/test.py", line 23, in <module>
G = ox.graph_from_place('Manhattan Island, New York City, New York, USA', network_type='drive')
File "/usr/local/lib/python2.7/site-packages/osmnx/core.py", line 1850, in graph_from_place
raise TypeError('query must be a string or a list of query strings')
TypeError: query must be a string or a list of query strings
如何让OSMnx运行此错误?
2 回答
这可能是因为有了
在你的代码中,since包括它将所有字符串转换为
unicode
类型,而API需要类型为string
的参数 . 如果存在,删除它将防止发生错误 .另见:https://github.com/gboeing/osmnx/issues/185