Remove code to populate countries table
This commit is contained in:
parent
d35403f1c7
commit
8accdb9259
1 changed files with 0 additions and 18 deletions
|
@ -13,24 +13,6 @@ class CreateCountries < ActiveRecord::Migration
|
|||
end
|
||||
|
||||
add_index :countries, [:code], :name => "countries_code_idx", :unique => true
|
||||
|
||||
Net::HTTP.start('ws.geonames.org') do |http|
|
||||
xml = REXML::Document.new(http.get("/countryInfo").body)
|
||||
|
||||
xml.elements.each("geonames/country") do |ele|
|
||||
code = ele.get_text("countryCode").to_s
|
||||
minlon = ele.get_text("bBoxWest").to_s
|
||||
minlat = ele.get_text("bBoxSouth").to_s
|
||||
maxlon = ele.get_text("bBoxEast").to_s
|
||||
maxlat = ele.get_text("bBoxNorth").to_s
|
||||
|
||||
Country.create(
|
||||
:code => code,
|
||||
:min_lat => minlat.to_f, :max_lat => maxlat.to_f,
|
||||
:min_lon => minlon.to_f, :max_lon => maxlon.to_f
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue