Beispiel #1
0
 def _get_coords_from_gmaps(self):
     coords_from_gmaps = gmaps.get_lat_lon(self._address)
     if 'lat' in coords_from_gmaps and 'lng' in coords_from_gmaps:
         self._coords = coords_from_gmaps
     else:
         raise IOError("gmaps didn`t provide coords for adress %s" %
                       self._address)
Beispiel #2
0
def write_sample_cities_data_to_file(cities_names):
    import gmaps
    out_fname = 'example_locs_to_read_from.txt'
    with open(out_fname, 'w') as f:
        for name in cities_names:
            coords = gmaps.get_lat_lon(name)
            # print(coords)
            f.write("%s,%f,%f\n" % (name, coords['lat'], coords['lng']))
    print("sample cities data written to file '%s'" % out_fname)
    return out_fname
Beispiel #3
0
def write_sample_cities_data_to_file(cities_names):
	import gmaps
	out_fname = 'example_locs_to_read_from.txt'
	with open(out_fname,'w') as f:
		for name in cities_names:
			coords = gmaps.get_lat_lon(name)
			# print(coords)
			f.write("%s,%f,%f\n" % (name,coords['lat'],coords['lng']))
	print("sample cities data written to file '%s'" % out_fname)
	return out_fname
Beispiel #4
0
 def _get_coords_from_gmaps(self):
     coords_from_gmaps = gmaps.get_lat_lon(self._address)
     if 'lat' in coords_from_gmaps and 'lng' in coords_from_gmaps:
         self._coords = coords_from_gmaps
     else:
         raise IOError("gmaps didn`t provide coords for adress %s" % self._address)