worlddb 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Manifest.txt CHANGED
@@ -64,6 +64,7 @@ db/europe/sc/cities.txt
64
64
  db/europe/se/cities.txt
65
65
  db/europe/tr/cities.txt
66
66
  db/europe/ua/cities.txt
67
+ db/europe/wa/cities.txt
67
68
  db/oceania/au/cities.txt
68
69
  db/oceania/countries.txt
69
70
  db/oceania/de.countries.yml
@@ -1,10 +1,39 @@
1
1
  ##################################
2
2
  ## africa
3
3
  ##
4
+ ## -> http://en.wikipedia.org/wiki/Africa#Territories_and_regions
4
5
 
5
- dz, Algeria, ALG
6
- ci, Côte d'Ivoire, CIV
7
- gh, Ghana, GHA
8
- cm, Cameroon, CMR
9
- ng, Nigeria, NGA
10
- za, South Africa, RSA
6
+ ###
7
+ ## regions:
8
+ # - Northern Africa
9
+ # - Western Africa
10
+ # - Central Africa
11
+ # - Eastern Africa
12
+ # - Southern Africa
13
+
14
+
15
+ ###############
16
+ ## Northern Africa
17
+ ##
18
+
19
+ dz, Algeria, ALG, 2_381_740, 34_178_188, ar|northern africa
20
+ eg, Egypt, EGY, 1_001_450, 82_868_000, ar|northern africa
21
+ ma, Morocco, MAR, 446_550, 34_859_364, ar|northern africa
22
+ ly, Libya, LBY, 1_759_540, 6_310_434, ar|northern africa
23
+ tn, Tunisia, TUN, 163_610, 10_486_339, ar|northern africa
24
+
25
+
26
+ #######
27
+ ### More
28
+
29
+ ci, Côte d'Ivoire, CIV, 322_460, 20_617_068, western africa
30
+ gh, Ghana, GHA, 239_460, 23_832_495, western africa
31
+ ng, Nigeria, NGA, 923_768, 166_629_000, western africa
32
+
33
+ cm, Cameroon, CMR, 475_440, 18_879_301, central africa
34
+
35
+
36
+ ################
37
+ ## Southern Africa
38
+
39
+ za, South Africa, RSA, 1_219_912, 51_770_560, southern africa|g5|g20
@@ -38,3 +38,11 @@ saintjohn, Saint John, region:nb, 126_000
38
38
  thunderbay, Thunder Bay, region:on, 126_000
39
39
  barrie, Barrie, region:on, 119_000
40
40
  sydney, Sydney, region:ns, 118_000
41
+
42
+ # add more captials
43
+
44
+ frederiction, Frederiction, region:nb
45
+ yellowknife, Yellowknife, region:nt
46
+ iqaluit, Iqaluit, region:nu
47
+ charlottetown, Charlottetown, region:pe
48
+ whitehorse, Whitehorse, region:yt
@@ -9,20 +9,20 @@
9
9
  # http://en.wikipedia.org/wiki/List_of_regions_of_Canada
10
10
 
11
11
 
12
- bc, British Columbia, 922509, western canada
12
+ bc, British Columbia, 922509, en|western canada
13
13
 
14
- ab, Alberta, 640082, western canada|prairies
15
- mb, Manitoba, 552330, western canada|prairies
16
- sk, Saskatchewan, 588239, western canada|prairies
14
+ ab, Alberta, 640082, en|western canada|prairies
15
+ mb, Manitoba, 552330, en|western canada|prairies
16
+ sk, Saskatchewan, 588239, en|western canada|prairies
17
17
 
18
- nb, New Brunswick, 71377, eastern canada|atlantic canada|maritimes
19
- ns, Nova Scotia, 52939, eastern canada|atlantic canada|maritimes
20
- pe, Prince Edward Island, 5686, eastern canada|atlantic canada|maritimes
21
- nl, Newfoundland and Labrador, 370511, eastern canada|atlantic canada
18
+ nb, New Brunswick, 71377, en|fr|eastern canada|atlantic canada|maritimes
19
+ ns, Nova Scotia, 52939, en|eastern canada|atlantic canada|maritimes
20
+ pe, Prince Edward Island, 5686, en|eastern canada|atlantic canada|maritimes
21
+ nl, Newfoundland and Labrador, 370511, en|eastern canada|atlantic canada
22
22
 
23
- on, Ontario, 908608, eastern canada|central canada
24
- qc, Québec, 1356547, eastern canada|central canada
23
+ on, Ontario, 908608, en|eastern canada|central canada
24
+ qc, Québec, 1356547, fr|en|eastern canada|central canada
25
25
 
26
- nt, Northwest Territories, 1143793, northern canada|territories
27
- yt, Yukon, 474713, northern canada|territories
28
- nu, Nunavut, 1877788, northern canada|territories
26
+ nt, Northwest Territories, 1143793, en|fr|northern canada|territories
27
+ yt, Yukon, 474713, en|northern canada|territories
28
+ nu, Nunavut, 1877788, iu|en|fr|northern canada|territories
@@ -1,34 +1,51 @@
1
1
  ###################################################
2
2
  ## north/central/south america & caribbean islands
3
3
 
4
+ ## regions
5
+ ## North America
6
+ ## Central America
7
+ ## Caribbean
8
+ ## South America
9
+ ## extra Latin America
10
+
4
11
  #####################
5
12
  #### north america
6
13
 
7
14
  # area (in sq km), pop(ulation)
8
15
 
9
- ca, Canada, CAN, 9984670, 34278406, north america|en|fr
10
- mx, Mexico, MEX, 1972550, 112322757, north america|es
11
- us, United States, USA, 9629091, 314167157, north america|en|es
16
+ ca, Canada, CAN, 9_984_670, 34_278_406, en|fr| north america|g8|g20
17
+ us, United States, USA, 9_629_091, 314_167_157, en|es| north america|g8|g20
18
+ mx, México [Mexico], MEX, 1_972_550, 112_322_757, es| north america|g5|g20
12
19
 
13
20
  #####################
14
21
  ## central america & caribbean islands
15
22
 
16
- cr, Costa Rica, CRC
17
- hn, Honduras, HON
18
- sv, El Salvador, SLV
19
-
23
+ bz, Belize, BLZ, 22_966, 307_000, en|es|central_america
24
+ gt, Guatemala, GUA, 108_889, 14_027_000, es|central_america
25
+ cr, Costa Rica, CRC, 51_100, 4_579_000, es|central_america
26
+ hn, Honduras, HON, 112_492, 7_466_000, es|central_america
27
+ sv, El Salvador, SLV, 21_041, 6_163_000, es|central_america
28
+ ni, Nicaragua, NCA, 130_373, 5_743_000, es|central_america
29
+ pa, Panamá [Panama], PAN, 75_417, 3_454_000, es|central_america
30
+
31
+
32
+ cu, Cuba, CUB, 109_886, 11_204_000, es|caribbean
33
+ jm, Jamaica, JAM, 10_991, 2_719_000, en|caribbean
34
+ pr, Puerto Rico, PUR, 8_870, 3_982_000, country:us, es|en|caribbean
35
+ do, Dominican Republic, DOM, 48_671, 10_090_000, es|caribbean
36
+
20
37
  ##############
21
38
  ## south america
22
39
 
23
- ar, Argentina, ARG, 2780400, 40518425, south america|es
24
- bo, Bolivia, BOL, 1098581, 10907778, south america|es
25
- br, Brazil, BRA, 8514215, 192380000, south america|pt
26
- cl, Chile, CHI, 755696, 16763470, south america|es
27
- co, Colombia, COL, 1138748, 46413791, south america|es
28
- ec, Ecuador, ECU, 258238, 15007343, south america|es
29
- gy, Guyana, GUY, 214970, 752940, south america|en
30
- pe, Peru, PER, 1285220, 29546963, south america|es
31
- sr, Suriname, SUR, 163820, 492829, south america|nl
32
- py, Paraguay, PAR, 406752, 6375830, south america|es
33
- uy, Uruguay, URU, 176215, 3510386, south america|es
34
- ve, Venezuela, VEN, 916445, 28833845, south america|es
40
+ ar, Argentina, ARG, 2_780_400, 40_518_425, es| south america|g20
41
+ bo, Bolivia, BOL, 1_098_581, 10_907_778, es|qu|ay| south america
42
+ br, Brazil, BRA, 8_514_215, 192_380_000, pt| south america|g5|g20
43
+ cl, Chile, CHI, 755_696, 16_763_470, south america|es
44
+ co, Colombia, COL, 1_138_748, 46_413_791, south america|es
45
+ ec, Ecuador, ECU, 258_238, 15_007_343, south america|es|qu
46
+ gy, Guyana, GUY, 214_970, 752_940, south america|en
47
+ pe, Peru, PER, 1_285_220, 29_546_963, south america|es
48
+ sr, Suriname, SUR, 163_820, 492_829, south america|nl
49
+ py, Paraguay, PAR, 406_752, 6_375_830, south america|es
50
+ uy, Uruguay, URU, 176_215, 3_510_386, south america|es
51
+ ve, Venezuela, VEN, 916_445, 28_833_845, south america|es
@@ -2,13 +2,70 @@
2
2
  ### asia (includes middle east)
3
3
  ##
4
4
 
5
- ## NB: uefa country kazakhstan is listed here
5
+ ## NB: uefa country georgia, armenia, kazakhstan are listed here
6
6
  ## NB: australia is listed in oceania (w/ australia)
7
7
 
8
8
 
9
- jp, Japan, JPN
10
- kp, North Korea, PRK
11
- kr, South Korea, KOR
12
- in, India, IND
13
- kz, Kazakhstan, KAZ, uefa
9
+ ####
10
+ # regions (United Nations geoscheme)
11
+ # - Central Asia
12
+ # - East Asia
13
+ # - North Asia
14
+ # - South Asia | Southern Asia
15
+ # - Southeast Asia
16
+ # - Western Asia | Middle East | Near East
17
+ # o Arabian Peninsula
18
+ # o South Caucasus
19
+ # o Fertile Crescent
20
+
21
+ ###
22
+ # central asia
23
+ # -> http://en.wikipedia.org/wiki/Central_Asia
24
+
25
+
26
+ kz, Kazakhstan, KAZ, 2_724_900, 16_600_000, uefa|europe|central asia
27
+
28
+ ########
29
+ ## middle east (nb: egypt listed in africa)
30
+
31
+ sa, Saudi Arabia, KSA, 1_960_582, 27_136_977, middle_east|western_asia|arabian peninsula|g20
32
+
33
+ il, Israel, ISR, 20_770, 7_653_600, middle_east|western_asia|fertile crescent
34
+ pn, Palestine, PAL, 6_220, 4_260_636, middle_east|western_asia|fertile crescent
35
+
36
+ ## add to middle east?
37
+
38
+ ge, Georgia, GEO, 69_700, 4_570_934, uefa|europe|western asia|south caucasus
39
+ am, Armenia, ARM, 29_743, 2_970_495, uefa|europe|western asia|south caucasus
40
+
41
+
42
+ #####
43
+ # east asia
44
+
45
+ jp, Japan, JPN, 377_930, 127_950_000, east_asia|g8|g20
46
+ kp, North Korea, PRK, 120_538, 24_346_000, east_asia
47
+ kr, South Korea, KOR, 99_828, 48_988_833, east_asia|g20
48
+ cn, China, CHN, 9_596_961, 1_339_724_852, east_asia|g5|g20
49
+ hk, Hong Kong, HKG, 1_104, 7_061_200, country:cn, east_asia
50
+ tw, Taiwan, TAI, 36_188, 23_174_528, east_asia
51
+
52
+
53
+ ####
54
+ # southeast asia
55
+
56
+ id, Indonesia, IDN, 1_904_569, 241_030_522, southeast_asia|g20
57
+ my, Malaysia, MAS, 329_847, 28_731_000, southeast_asia
58
+ sg, Singapore, SIN, 724, 5_274_700, southeast_asia
59
+ th, Thailand, THA, 513_120, 64_076_000, southeast_asia
60
+ ph, Philippines, PHI, 300_000, 95_856_000, southeast_asia
61
+ vn, Vietnam, VIE, 331_210, 89_316_000, southeast_asia
62
+
63
+ ####
64
+ # south asia
65
+
66
+ pk, Pakistan, PAK, 796_095, 180_440_000, south_asia
67
+ in, India, IND, 3_287_240, 1_210_193_422, south_asia|g5|g20
68
+ bd, Bangladesh, BAN, 147_570, 152_518_015, south_asia
69
+ np, Nepal, NEP, 147_181, 26_620_080, south_asia
70
+ lk, Sri Lanka, SRI, 65_610, 20_277_597, south_asia
14
71
 
@@ -6,8 +6,9 @@
6
6
  # NB: using iso three letter codes (cut off first letter is always V or W for NUTS1 region)
7
7
 
8
8
  ## todo: check what code to use for bruxeelles -> br is taken by Babant Wallon
9
+ ## official code is BRU; no unique official two letter code available?
9
10
 
10
- bx, Bruxelles|Brussel [Brussels (Capital Region)], 161
11
+ bx, Bruxelles|Brussel [Brussels (Capital Region)], 161, fr|nl
11
12
 
12
13
  an, Antwerpen [Antwerp], 2_867, flanders|nl
13
14
  li, Limburg, 2_422, flanders|nl
@@ -27,16 +27,16 @@
27
27
 
28
28
  ## eu 27 (+ euro 17)
29
29
 
30
- eu, European Union, EUR, 4_324_782, supra # NB: no FIFA code exists; use EUR
30
+ eu, European Union, EUR, 4_324_782, 503_492_041, supra # NB: no FIFA code exists; use EUR
31
31
 
32
32
  ## todo: auto-add tag eu?? for supra:eu?
33
33
 
34
- at, Austria, AUT, 83_871, 8_414_638, supra:eu, eu|euro|schengen|uefa|central europe
35
- be, Belgium, BEL, 30_528, 11_007_020, supra:eu, eu|euro|schengen|uefa|benelux
36
- cy, Cyprus, CYP, 9_251, 1_099_341, supra:eu, eu|euro|uefa|asia
37
- de, Germany, GER, 357_050, 81_799_600, supra:eu, eu|euro|schengen|uefa|g8|g20|western europe|central europe # NB: ISO (DEU) <> FIFA (GER)
34
+ at, Austria, AUT, 83_871, 8_414_638, supra:eu, de| eu|euro|schengen|uefa|central europe
35
+ be, Belgium, BEL, 30_528, 11_007_020, supra:eu, nl|fr|de| eu|euro|schengen|uefa|benelux
36
+ cy, Cyprus, CYP, 9_251, 1_099_341, supra:eu, eu|euro|uefa|asia|western asia
37
+ de, Germany, GER, 357_050, 81_799_600, supra:eu, de| eu|euro|schengen|uefa|g8|g20|western europe|central europe # NB: ISO (DEU) <> FIFA (GER)
38
38
  ee, Estonia, EST, 45_226, 1_340_194, supra:eu, eu|euro|schengen|uefa
39
- es, Spain, ESP, 506_030, 46_030_109 supra:eu, eu|euro|schengen|uefa
39
+ es, Spain, ESP, 506_030, 46_030_109, supra:eu, eu|euro|schengen|uefa
40
40
  fi, Finland, FIN, 338_145, 5_391_700, supra:eu, eu|euro|schengen|uefa
41
41
  fr, France, FRA, 674_843, 65_821_885, supra:eu, eu|euro|schengen|uefa|g8|g20
42
42
  gr, Greece, GRE, 131_990, 10_787_690, supra:eu, eu|euro|schengen|uefa # NB: ISO (GRC) <> FIFA (GRE)
@@ -57,23 +57,25 @@ lt, Lithuania, LTU, 65_303, 3_207_060, supra:eu, eu|uefa|schengen
57
57
  pl, Poland, POL, 312_683, 38_186_860, supra:eu, eu|uefa|schengen
58
58
  ro, Romania, ROU, 238_391, 19_042_936, supra:eu, eu|uefa
59
59
  se, Sweden, SWE, 449_964, 9_415_570, supra:eu, eu|uefa|schengen
60
- cz, Czech Republic, CZE, 78_866, 10_535_811, supra:eu, eu|uefa|schengen
60
+ cz, Czech Republic, CZE, 78_866, 10_535_811, supra:eu, cs|sk| eu|uefa|schengen
61
61
  hu, Hungary, HUN, 93_030, 9_979_000, supra:eu, eu|uefa|schengen
62
62
 
63
63
 
64
64
  en, England, ENG, 130_395, 53_013_000, country:gb # NB: FIFA (ENG); not a valid iso country n internet domain / its uk - what to use - anything better?
65
65
  sc, Scotland, SCO, 78_387, 5_254_800, country:gb # NB: FIFA (SCO); not a valid iso country/internet domain - its uk - what to use - anything better?
66
+ wa, Wales, WAL, 20_779, 3_064_000, country:gb
67
+
66
68
 
67
69
  fo, Faroe Islands, FRO, 1_399, 49_267, country:dk
68
70
 
69
71
  ad, Andorra, AND, 468, 85_082
70
72
  al, Albania, ALB, 28_748, 3_002_859
71
73
  by, Belarus, BLR, 207_600, 9_643_566
72
- ch, Switzerland, SUI, 41_285, 7_866_500, schengen|uefa|un # NB: ISO (CHE) <> FIFA (SUI)
74
+ ch, Switzerland, SUI, 41_285, 7_866_500, de|fr|it|rm| schengen|uefa|un # NB: ISO (CHE) <> FIFA (SUI)
73
75
  hr, Croatia, CRO, 56_594, 4_290_612 # NB: ISO (HRV) <> FIFA (CRO); local name: Hrvatska
74
76
  rs, Serbia, SRB, 88_361, 7_276_604
75
- ru, Russia, RUS, 17_098_242, 142_517_670, asia|g8|g20
76
- tr, Turkey, TUR, 783_562, 79_749_461, asia
77
+ ru, Russia, RUS, 17_098_242, 142_517_670, asia|north asia|g8|g20
78
+ tr, Turkey, TUR, 783_562, 79_749_461, asia|western asia|g20
77
79
  ua, Ukraine, UKR, 603_550, 44_854_065
78
80
  mk, Macedonia, MKD, 25_713, 2_082_370
79
81
  no, Norway, NOR, 385_155, 4_993_300, schengen|uefa
@@ -82,7 +84,3 @@ is, Iceland, ISL, 103_000, 318_452, schengen|uefa
82
84
 
83
85
  ## todo/fix: add missing countries
84
86
 
85
- ## move to asia??
86
-
87
- ge, Georgia, GEO, 69_700, 4_570_934, uefa|asia
88
- am, Armenia, ARM, 29_743, 2_970_495, uefa|asia
@@ -28,9 +28,3 @@ wigan, Wigan, region:nw, 81203
28
28
  southampton, Southampton, region:se, 239700
29
29
  reading, Reading, region:se, 155700
30
30
  norwich, Norwich, region:ee, 140200
31
-
32
- ####
33
- ## from wales; keep it here (w/ england?) add it to gb - great britain?
34
-
35
- swansea, Swansea, region:wa, 239000
36
-
@@ -0,0 +1,3 @@
1
+
2
+ swansea, Swansea, 239000
3
+
@@ -1,5 +1,17 @@
1
1
  ###############################
2
2
  ## australia & oceania
3
3
 
4
- au, Australia, AUS
5
- nz, New Zealand, NZL
4
+ ####
5
+ ## regions
6
+ ## - Melanesia
7
+ ## - Micronesia
8
+ ## - Polynesia
9
+
10
+
11
+ au, Australia, AUS, 7_686_850, 22_028_000, en|g20
12
+ nz, New Zealand, NZL, 268_680, 4_108_037, en
13
+
14
+ ##############
15
+ ### Melanesia
16
+
17
+ pg, Papua New Guinea, PNG, 462_840, 5_172_033
@@ -19,6 +19,18 @@ class Country < ActiveRecord::Base
19
19
  validates :code, :format => { :with => /^[A-Z_]{3}$/, :message => 'expected three uppercase letters A-Z (and _)' }
20
20
 
21
21
 
22
+ def self.by_title # order by title (a-z)
23
+ self.order( 'title asc' )
24
+ end
25
+
26
+ def self.by_pop # order by pop(ulation)
27
+ self.order( 'pop asc' )
28
+ end
29
+
30
+ def self.by_area # order by area (in square km)
31
+ self.order( 'area asc')
32
+ end
33
+
22
34
  def title_w_synonyms
23
35
  return title if synonyms.blank?
24
36
 
@@ -15,8 +15,8 @@ create_table :countries do |t|
15
15
  t.string :key, :null => false
16
16
  t.string :code, :null => false # short three letter code (FIFA country code e.g. ITA)
17
17
  t.string :synonyms # comma separated list of synonyms
18
- t.integer :pop # optional population count
19
- t.integer :area # optional area in square km (sq. km)
18
+ t.integer :pop, :null => false # population count
19
+ t.integer :area, :null => false # area in square km (sq. km)
20
20
  t.references :country # for supra(nationals) n depend(encies)
21
21
  t.boolean :s, :null => false, :default => false # supra(national) flag e.g. eu
22
22
  t.boolean :c, :null => false, :default => false # country flag (is this needed?)
@@ -1,5 +1,5 @@
1
1
 
2
2
  module WorldDB
3
- VERSION = '0.6.2'
3
+ VERSION = '0.6.3'
4
4
  end
5
5
 
data/lib/worlddb.rb CHANGED
@@ -121,6 +121,7 @@ module WorldDB
121
121
  'europe/se/cities',
122
122
  'europe/tr/cities',
123
123
  'europe/ua/cities',
124
+ 'europe/wa/cities',
124
125
  'oceania/countries',
125
126
  'oceania/au/cities'
126
127
  ]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: worlddb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 2
10
- version: 0.6.2
9
+ - 3
10
+ version: 0.6.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gerald Bauer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-25 00:00:00 Z
18
+ date: 2012-11-26 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activerecord
@@ -124,6 +124,7 @@ extra_rdoc_files:
124
124
  - db/europe/se/cities.txt
125
125
  - db/europe/tr/cities.txt
126
126
  - db/europe/ua/cities.txt
127
+ - db/europe/wa/cities.txt
127
128
  - db/oceania/au/cities.txt
128
129
  - db/oceania/countries.txt
129
130
  files:
@@ -193,6 +194,7 @@ files:
193
194
  - db/europe/se/cities.txt
194
195
  - db/europe/tr/cities.txt
195
196
  - db/europe/ua/cities.txt
197
+ - db/europe/wa/cities.txt
196
198
  - db/oceania/au/cities.txt
197
199
  - db/oceania/countries.txt
198
200
  - db/oceania/de.countries.yml