【问题标题】:GeoPy is not working: What is the reason of NOT getting results for nom.geocode()?GeoPy 不工作:没有得到 nom.geocode() 的结果的原因是什么?
【发布时间】:2020-02-01 18:43:33
【问题描述】:

我已经安装了证书(使用了来自不同线程的这个建议)。Here's the code and the result

from geopy.geocoders import ArcGIS

nom = ArcGIS()
location=nom.geocode("3995 23rd st, San Francisco, CA 94114",timeout=180)
print(location)

有什么问题?我没有得到经度/纬度的结果。 如何得到结果?

请帮忙。

【问题讨论】:

  • 添加print(location)的结果?它是打印地址而不是点吗?

标签: python-3.x geopy


【解决方案1】:

使用您的代码,

>>> print(location)  
3995 23rd St, San Francisco, California, 94114
>>> location
Location(3995 23rd St, San Francisco, California, 94114, (37.752990821253434, -122.43170235858965, 0.0))

点在那里,但print() 不打印它们,只是与它们关联的地址文本字符串。

location 基本上是地理编码服务返回的结果的字典。

>>> type(location)
<class 'geopy.location.Location'>
>>> location.latitude
37.752990821253434
>>> location.longitude
-122.43170235858965

here are the docs 用于存储结果的位置类。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-07-09
    • 1970-01-01
    • 1970-01-01
    • 2020-07-23
    • 1970-01-01
    • 1970-01-01
    • 2021-11-23
    相关资源
    最近更新 更多