예제 #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)
예제 #2
0
파일: tools.py 프로젝트: serggres/othodi
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
예제 #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
예제 #4
0
파일: locm.py 프로젝트: serggres/othodi
 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)