worlddb 0.5.0 → 0.6.0
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 +18 -0
- data/db/america/ca/cities.txt +40 -7
- data/db/america/ca/regions.txt +28 -10
- data/db/america/mx/cities.txt +32 -15
- data/db/america/mx/regions.txt +54 -0
- data/db/america/us/cities.txt +46 -16
- data/db/america/us/regions.txt +64 -10
- data/db/europe/at/cities.txt +30 -17
- data/db/europe/at/regions.txt +19 -10
- data/db/europe/be/cities.txt +19 -1
- data/db/europe/be/regions.txt +21 -0
- data/db/europe/bg/cities.txt +4 -0
- data/db/europe/by/cities.txt +3 -0
- data/db/europe/ch/cities.txt +3 -0
- data/db/europe/countries.txt +62 -39
- data/db/europe/cz/cities.txt +26 -0
- data/db/europe/cz/regions.txt +32 -0
- data/db/europe/de/cities.txt +44 -18
- data/db/europe/de/regions.txt +16 -16
- data/db/europe/dk/cities.txt +5 -0
- data/db/europe/ee/cities.txt +2 -0
- data/db/europe/en/cities.txt +36 -13
- data/db/europe/en/regions.txt +21 -0
- data/db/europe/es/cities.txt +17 -5
- data/db/europe/es/regions.txt +26 -0
- data/db/europe/fi/cities.txt +2 -0
- data/db/europe/fr/cities.txt +15 -4
- data/db/europe/fr/regions.txt +32 -0
- data/db/europe/gr/cities.txt +5 -0
- data/db/europe/hu/cities.txt +2 -0
- data/db/europe/ie/cities.txt +3 -0
- data/db/europe/it/cities.txt +16 -3
- data/db/europe/lt/cities.txt +4 -0
- data/db/europe/lv/cities.txt +3 -0
- data/db/europe/nl/cities.txt +11 -2
- data/db/europe/no/cities.txt +3 -0
- data/db/europe/pl/cities.txt +12 -0
- data/db/europe/pt/cities.txt +5 -2
- data/db/europe/ro/cities.txt +3 -0
- data/db/europe/rs/cities.txt +3 -0
- data/db/europe/ru/cities.txt +14 -2
- data/db/europe/sc/cities.txt +3 -1
- data/db/europe/se/cities.txt +3 -0
- data/db/europe/tr/cities.txt +3 -1
- data/db/europe/ua/cities.txt +9 -3
- data/lib/worlddb/console.rb +11 -9
- data/lib/worlddb/reader.rb +40 -3
- data/lib/worlddb/readers/values_reader.rb +12 -4
- data/lib/worlddb/schema.rb +18 -3
- data/lib/worlddb/version.rb +1 -1
- data/lib/worlddb.rb +23 -3
- metadata +40 -4
data/lib/worlddb/schema.rb
CHANGED
@@ -15,15 +15,22 @@ 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.string :motor # optional auto motor (vehicle) licene plate
|
19
18
|
t.integer :pop # optional population count
|
20
19
|
t.integer :area # optional area in square km (sq. km)
|
20
|
+
t.references :country # for supra(nationals) n depend(encies)
|
21
|
+
t.boolean :s, :null => false, :default => false # supra(national) flag e.g. eu
|
22
|
+
t.boolean :c, :null => false, :default => false # country flag (is this needed?)
|
23
|
+
t.boolean :d, :null => false, :default => false # dependency flag
|
21
24
|
t.timestamps
|
25
|
+
|
26
|
+
# extras
|
27
|
+
t.string :motor # optional auto motor (vehicle) licene plate
|
22
28
|
end
|
23
29
|
|
24
30
|
create_table :regions do |t|
|
25
31
|
t.string :title, :null => false
|
26
32
|
t.string :key, :null => false
|
33
|
+
t.string :code # short three letter code
|
27
34
|
t.string :synonyms # comma separated list of synonyms
|
28
35
|
t.references :country, :null => false
|
29
36
|
t.integer :pop # optional population count
|
@@ -38,10 +45,18 @@ create_table :cities do |t|
|
|
38
45
|
t.string :synonyms # comma separated list of synonyms
|
39
46
|
t.references :country, :null => false
|
40
47
|
t.references :region # optional for now
|
41
|
-
t.integer :pop # optional population count
|
48
|
+
t.integer :pop # optional population count (city proper)
|
49
|
+
t.integer :popm # optional population count (metropolitan/aglomeration)
|
42
50
|
t.integer :area # optional area in square km (sq. km)
|
43
|
-
t.
|
51
|
+
t.float :lat # optional for now
|
52
|
+
t.float :lng # optional for now
|
53
|
+
t.boolean :m, :null => false, :default => false # metro flag
|
54
|
+
t.boolean :c, :null => false, :default => false # city flag (is this needed?)
|
55
|
+
t.boolean :d, :null => false, :default => false # district flag
|
56
|
+
t.references :city # optional parent (e.g. metro for city, or city for district)
|
44
57
|
t.timestamps
|
58
|
+
|
59
|
+
### t.boolean :capital, :null => false, :default => false # is national captial?
|
45
60
|
end
|
46
61
|
|
47
62
|
create_table :tags do |t|
|
data/lib/worlddb/version.rb
CHANGED
data/lib/worlddb.rb
CHANGED
@@ -73,6 +73,7 @@ module WorldDB
|
|
73
73
|
'america/br/cities',
|
74
74
|
'america/ca/regions',
|
75
75
|
'america/ca/cities',
|
76
|
+
'america/mx/regions',
|
76
77
|
'america/mx/cities',
|
77
78
|
'america/us/regions',
|
78
79
|
'america/us/cities',
|
@@ -83,24 +84,41 @@ module WorldDB
|
|
83
84
|
'europe/countries',
|
84
85
|
'europe/at/regions',
|
85
86
|
'europe/at/cities',
|
87
|
+
'europe/be/regions',
|
86
88
|
'europe/be/cities',
|
89
|
+
'europe/bg/cities',
|
87
90
|
'europe/by/cities',
|
88
91
|
'europe/ch/cities',
|
89
92
|
'europe/cy/cities',
|
93
|
+
'europe/cz/regions',
|
94
|
+
'europe/cz/cities',
|
90
95
|
'europe/de/regions',
|
91
96
|
'europe/de/cities',
|
92
97
|
'europe/dk/cities',
|
98
|
+
'europe/ee/cities',
|
99
|
+
'europe/en/regions',
|
93
100
|
'europe/en/cities',
|
101
|
+
'europe/es/regions',
|
94
102
|
'europe/es/cities',
|
103
|
+
'europe/fi/cities',
|
104
|
+
'europe/fr/regions',
|
95
105
|
'europe/fr/cities',
|
96
106
|
'europe/gr/cities',
|
97
107
|
'europe/hr/cities',
|
108
|
+
'europe/hu/cities',
|
109
|
+
'europe/ie/cities',
|
98
110
|
'europe/it/cities',
|
111
|
+
'europe/lt/cities',
|
112
|
+
'europe/lv/cities',
|
99
113
|
'europe/nl/cities',
|
114
|
+
'europe/no/cities',
|
115
|
+
'europe/pl/cities',
|
100
116
|
'europe/pt/cities',
|
101
117
|
'europe/ro/cities',
|
118
|
+
'europe/rs/cities',
|
102
119
|
'europe/ru/cities',
|
103
120
|
'europe/sc/cities',
|
121
|
+
'europe/se/cities',
|
104
122
|
'europe/tr/cities',
|
105
123
|
'europe/ua/cities',
|
106
124
|
'oceania/countries',
|
@@ -165,9 +183,11 @@ module WorldDB
|
|
165
183
|
|
166
184
|
def tables
|
167
185
|
puts "Stats:"
|
168
|
-
puts " #{'%5d' % Country.count} countries"
|
186
|
+
puts " #{'%5d' % Country.count} countries (#{Country.where(s: true).count} supras, #{Country.where(d:true).count} deps)"
|
169
187
|
puts " #{'%5d' % Region.count} regions"
|
170
|
-
puts " #{'%5d' % City.count}
|
188
|
+
puts " #{'%5d' % City.where(m: true).where(c: false).count} metros"
|
189
|
+
puts " #{'%5d' % City.where(c: true).count} cities (#{City.where(c: true).where(m: true).count} metros)"
|
190
|
+
puts " #{'%5d' % City.where(d: true).count} districts"
|
171
191
|
puts " #{'%5d' % Tag.count} tags"
|
172
192
|
puts " #{'%5d' % Tagging.count} taggings"
|
173
193
|
end
|
@@ -183,7 +203,7 @@ module WorldDB
|
|
183
203
|
def self.stats
|
184
204
|
stats = Stats.new
|
185
205
|
stats.tables
|
186
|
-
stats.props
|
206
|
+
### stats.props
|
187
207
|
end
|
188
208
|
|
189
209
|
def self.tables
|
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:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 6
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.6.0
|
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-
|
18
|
+
date: 2012-11-24 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activerecord
|
@@ -77,6 +77,7 @@ extra_rdoc_files:
|
|
77
77
|
- db/america/ca/regions.txt
|
78
78
|
- db/america/countries.txt
|
79
79
|
- db/america/mx/cities.txt
|
80
|
+
- db/america/mx/regions.txt
|
80
81
|
- db/america/us/cities.txt
|
81
82
|
- db/america/us/regions.txt
|
82
83
|
- db/america/ve/cities.txt
|
@@ -86,24 +87,41 @@ extra_rdoc_files:
|
|
86
87
|
- db/europe/at/cities.txt
|
87
88
|
- db/europe/at/regions.txt
|
88
89
|
- db/europe/be/cities.txt
|
90
|
+
- db/europe/be/regions.txt
|
91
|
+
- db/europe/bg/cities.txt
|
89
92
|
- db/europe/by/cities.txt
|
90
93
|
- db/europe/ch/cities.txt
|
91
94
|
- db/europe/countries.txt
|
92
95
|
- db/europe/cy/cities.txt
|
96
|
+
- db/europe/cz/cities.txt
|
97
|
+
- db/europe/cz/regions.txt
|
93
98
|
- db/europe/de/cities.txt
|
94
99
|
- db/europe/de/regions.txt
|
95
100
|
- db/europe/dk/cities.txt
|
101
|
+
- db/europe/ee/cities.txt
|
96
102
|
- db/europe/en/cities.txt
|
103
|
+
- db/europe/en/regions.txt
|
97
104
|
- db/europe/es/cities.txt
|
105
|
+
- db/europe/es/regions.txt
|
106
|
+
- db/europe/fi/cities.txt
|
98
107
|
- db/europe/fr/cities.txt
|
108
|
+
- db/europe/fr/regions.txt
|
99
109
|
- db/europe/gr/cities.txt
|
100
110
|
- db/europe/hr/cities.txt
|
111
|
+
- db/europe/hu/cities.txt
|
112
|
+
- db/europe/ie/cities.txt
|
101
113
|
- db/europe/it/cities.txt
|
114
|
+
- db/europe/lt/cities.txt
|
115
|
+
- db/europe/lv/cities.txt
|
102
116
|
- db/europe/nl/cities.txt
|
117
|
+
- db/europe/no/cities.txt
|
118
|
+
- db/europe/pl/cities.txt
|
103
119
|
- db/europe/pt/cities.txt
|
104
120
|
- db/europe/ro/cities.txt
|
121
|
+
- db/europe/rs/cities.txt
|
105
122
|
- db/europe/ru/cities.txt
|
106
123
|
- db/europe/sc/cities.txt
|
124
|
+
- db/europe/se/cities.txt
|
107
125
|
- db/europe/tr/cities.txt
|
108
126
|
- db/europe/ua/cities.txt
|
109
127
|
- db/oceania/au/cities.txt
|
@@ -125,6 +143,7 @@ files:
|
|
125
143
|
- db/america/de.countries.yml
|
126
144
|
- db/america/es.countries.yml
|
127
145
|
- db/america/mx/cities.txt
|
146
|
+
- db/america/mx/regions.txt
|
128
147
|
- db/america/us/cities.txt
|
129
148
|
- db/america/us/regions.txt
|
130
149
|
- db/america/ve/cities.txt
|
@@ -135,26 +154,43 @@ files:
|
|
135
154
|
- db/europe/at/cities.txt
|
136
155
|
- db/europe/at/regions.txt
|
137
156
|
- db/europe/be/cities.txt
|
157
|
+
- db/europe/be/regions.txt
|
158
|
+
- db/europe/bg/cities.txt
|
138
159
|
- db/europe/by/cities.txt
|
139
160
|
- db/europe/ch/cities.txt
|
140
161
|
- db/europe/countries.txt
|
141
162
|
- db/europe/cy/cities.txt
|
163
|
+
- db/europe/cz/cities.txt
|
164
|
+
- db/europe/cz/regions.txt
|
142
165
|
- db/europe/de.countries.yml
|
143
166
|
- db/europe/de/cities.txt
|
144
167
|
- db/europe/de/regions.txt
|
145
168
|
- db/europe/dk/cities.txt
|
169
|
+
- db/europe/ee/cities.txt
|
146
170
|
- db/europe/en/cities.txt
|
171
|
+
- db/europe/en/regions.txt
|
147
172
|
- db/europe/es.countries.yml
|
148
173
|
- db/europe/es/cities.txt
|
174
|
+
- db/europe/es/regions.txt
|
175
|
+
- db/europe/fi/cities.txt
|
149
176
|
- db/europe/fr/cities.txt
|
177
|
+
- db/europe/fr/regions.txt
|
150
178
|
- db/europe/gr/cities.txt
|
151
179
|
- db/europe/hr/cities.txt
|
180
|
+
- db/europe/hu/cities.txt
|
181
|
+
- db/europe/ie/cities.txt
|
152
182
|
- db/europe/it/cities.txt
|
183
|
+
- db/europe/lt/cities.txt
|
184
|
+
- db/europe/lv/cities.txt
|
153
185
|
- db/europe/nl/cities.txt
|
186
|
+
- db/europe/no/cities.txt
|
187
|
+
- db/europe/pl/cities.txt
|
154
188
|
- db/europe/pt/cities.txt
|
155
189
|
- db/europe/ro/cities.txt
|
190
|
+
- db/europe/rs/cities.txt
|
156
191
|
- db/europe/ru/cities.txt
|
157
192
|
- db/europe/sc/cities.txt
|
193
|
+
- db/europe/se/cities.txt
|
158
194
|
- db/europe/tr/cities.txt
|
159
195
|
- db/europe/ua/cities.txt
|
160
196
|
- db/oceania/au/cities.txt
|