如何快速获取python中地址的经纬度?

How to get the latitude and longitude from the address in python quickly?

我已经使用了从给定地址查找经纬度的代码:

     locator = Nominatim(user_agent="myGeocoder")  # holds the Geocoding service, Nominatim
     geocode = RateLimiter(locator.geocode, min_delay_seconds=0.00000000000000000000000000000000000000000000000000000000000000000000000000001)
    data['MBR_location'] = data['MBR_Full_Address'].apply(lambda x: geocode(x))
     data['Prov_location'] = data['Prov_Full_Address'].apply(lambda x: geocode(x))

但是生成纬度和经度要花很多时间。比如这样,从10k的ID中获取经纬度需要3个小时。 有什么方法可以更快地得到结果吗?在此先感谢!

我想这需要这么长时间,因为您使用的是 OSM 的 public Nominatim 实例和 usage policy only allows one request per second. So either switch to a different Nominatim instance or install your own local Nominatim server.