【问题标题】:Trying to geocode with geopandas - AttributeError: 'module' object has no attribute 'Nominatim'尝试使用 geopandas 进行地理编码 - AttributeError: 'module' object has no attribute 'Nominatim'
【发布时间】:2014-03-23 02:30:02
【问题描述】:

我正在尝试修复在 geopandas 中使用地理编码功能时遇到的错误。

from geopandas.geocode import geocode
df['latlong'] = geocode(df.Location, provider="mapquest")

这是我看到的:

/Users/.../lib/python2.7/site-packages/geopandas-0.1.0.dev_-    py2.7.egg/geopandas/geocode.pyc in geocode(strings, provider, **kwargs)
 72               'mapquest': geopy.geocoders.MapQuest,
 73               'openmapquest': geopy.geocoders.OpenMapQuest,
---> 74               'nominatim' : geopy.geocoders.Nominatim}
 75 
 76     if provider not in coders:

AttributeError: 'module' object has no attribute 'Nominatim'

我确实尝试使用此处的说明安装插件,但没有任何乐趣:https://github.com/rdeguzman/python-nominatim

【问题讨论】:

    标签: python pandas geocoding nominatim geopandas


    【解决方案1】:

    Geopandas 需要 geopy 0.96.3。

    你可以安装它:

    pip install geopy==0.96.3
    

    此外,使用 Mapquest 地理编码器需要额外的 API 密钥参数:

    df['latlong'] = geocode(df.Location, provider="mapquest", api_key="MAPQUEST_API_KEY")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-26
      • 2014-12-20
      • 1970-01-01
      • 2022-12-01
      • 2022-12-01
      • 1970-01-01
      • 2012-02-29
      • 2013-07-26
      相关资源
      最近更新 更多