简体   繁体   English

Geocoder.google在Python中返回None值

[英]Geocoder.google returning None values in Python

I am trying to use the geocoder.google to find zipcodes from the lat, long values. 我正在尝试使用geocoder.google从经纬度长值中查找邮政编码。 It keeps returning None value. 它不断返回None值。

INPUT INPUT

a = gc.google([33.573256, -111.906344], method='reverse')
print a.postal
print a.address

OUTPUT OUTPUT

None
None

Can someone also tell me an easier way for converting Lat/long to zipcodes in python (preferably) or R. I have a csv file with about 58,000 rows. 有人还能告诉我一种将lat / long转换为python(最好是python)或R中的邮政编码的简便方法。我有一个约有58,000行的csv文件。 I want to find associated zipcodes to all these Lat,Lon values 我想找到与所有这些Lat,Lon值相关的邮政编码

From the Geopy github link 从Geopy github链接

https://github.com/geopy/geopy https://github.com/geopy/geopy

I used one of the examples to come up with a possible solution for you 我使用了其中一个示例为您提供了可能的解决方案

from geopy.geocoders import Nominatim
geolocator = Nominatim()
loc = geolocator.reverse("33.573256, -111.906344")
print(loc.address)

8006, East del Timbre Drive, Scottsdale, Maricopa County, Arizona, 85258, United States of America

This doesn't address the problem with the code you already have but it sounds like you are looking for any solution that works. 这不能解决已有代码的问题,但是听起来您正在寻找任何可行的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM