python 3.5 - geopy geocode does not map addr - browser googlemap does -


i trying map list of (~320+) texas addresses lat,lng.

i started using geopy (simple example) , worked addresses failed on set of addresses.

so integrated backup googlemaps geocode... failed. below code... see address_to_geopt.

yet, when submit failed addresses via browser, finds address... tips on how more reliable hits? googleapi should use (see address_to_geopt_googlemaps())

class geomap(dbxls):     def __init__(self, **kwargs):         super(umcgeomap, self).__init__(**kwargs)          # geo locator         self.gl = nominatim()         self.gmaps = googlemaps.client(key='mykeyisworking')           shname = self.xl.sheet_names[0] if 'sheet' not in kwargs else kwargs['sheet']         self.df = self.xl.parse(shname)      def address_to_geopt(self, addr):         l = self.geolocation(addr)         if l : return (l.latitude, l.longitude)          return (np.nan, np.nan)       def address_to_geopt_googlemaps(self, addr):         geocode = self.gmaps.geocode(addr)         if l == none : return (np.nan, np.nan)          # geocoding address         locdict = geocode[0]['geometry']['location']         return(locdict['lat'], locdict['lng'])              def address(self, church):         return (church.address1 + " "                                     + church.city + " "                                      + church.state + " "                                      + church.zipcode + " "                                     + church.country)       def church_to_geopt(self, church):         = (church.address1 + " "              + church.city + " "              + church.state)         if pd.isnull(church.geopt):             (lat, lng) = self.address_to_geopt(a)         else: (lat, lng ) = church.geopt         if not pd.isnull(lat) :              print("debug to_geopt 1", lat, lng, a)             return (lat,lng)         (lat, lng) = self.address_to_geopt_googlemaps(a)         print("debug to_geopt 2", lat, lng, a)         return (lat, lng) 

the following shows set of addresses not mapped geocoders.

4     3000 bee creek rd spicewood tx 78669-5109 usa 6             p o box 197 bertram tx 78605-0197 usa 10              2833 petuma dr kempher tx 78639 usa 

@geocodezip provided answer... , code worked next day.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -