Created
July 26, 2016 21:52
-
-
Save ashlynnpai/7756c55f037083d3da8823065b5dd9bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "geocoder" | |
list = [[38.0813888889,46.2930555556,0,1,1346,"Tabriz Historic Bazaar Complex"]] | |
def get_coordinates(list) | |
all_places = [] | |
list.each do |row| | |
place = [] | |
name = row[5] | |
lat = row[0] | |
long = row[1] | |
coordinates = lat.to_s + "," + long.to_s | |
addresses = Geocoder.search(coordinates) | |
address = addresses[0].formatted_address | |
place.push(name, address, lat, long) | |
all_places << place | |
end | |
File.open('cleaned.txt', 'w') { |file| file.write(all_places) } | |
all_places | |
end | |
get_coordinates(list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment