geomash 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d2a58829bedfce7344567760510778a35fbff6a7
4
+ data.tar.gz: ac507932824958db992508935d95cfa0f987e91b
5
+ SHA512:
6
+ metadata.gz: 97ad5a46b0af09358cb1ad552df0697026ae3d71cb3427522d7612d6aaf3248d96e2ba2b33c4e39f6026b5c81ceb838cbdfba00df74cac483fb4bb6b433c49aa
7
+ data.tar.gz: 6a59649a8dd01d2bba03548e52f84566a4d40301c7932f6145ffbb139f313939518b4cfc151059ebbae420f836aef4ef346851a3eab9f21ea6b53d5c553981c8
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Geomash'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+ Bundler::GemHelper.install_tasks
21
+
22
+ require 'rake/testtask'
23
+
24
+ Rake::TestTask.new(:test) do |t|
25
+ t.libs << 'lib'
26
+ t.libs << 'test'
27
+ t.pattern = 'test/**/*_test.rb'
28
+ t.verbose = false
29
+ end
30
+
31
+
32
+ task default: :test
@@ -0,0 +1,24 @@
1
+ development:
2
+ tgn_enabled: true
3
+ geonames_username: <username>
4
+ #NOTE: Mapquest is super unreliable on its matches...
5
+ mapquest_key: <mapquest_key>
6
+ #NOTE: Bing also fairly unreliable but mostly works...
7
+ bing_key: <bing_key>
8
+ timeout: 7
9
+ test: &TEST_
10
+ tgn_enabled: true
11
+ geonames_username: <username>
12
+ #NOTE: Mapquest is super unreliable on its matches...
13
+ mapquest_key: <mapquest_key>
14
+ #NOTE: Bing also fairly unreliable but mostly works...
15
+ bing_key: <bing_key>
16
+ timeout: 7
17
+ production:
18
+ tgn_enabled: true
19
+ geonames_username: <username>
20
+ #NOTE: Mapquest is super unreliable on its matches...
21
+ mapquest_key: <mapquest_key>
22
+ #NOTE: Bing also fairly unreliable but mostly works...
23
+ bing_key: <bing_key>
24
+ timeout: 7
data/lib/geomash.rb ADDED
@@ -0,0 +1,86 @@
1
+ module Geomash
2
+ require "geomash/constants"
3
+ require "geomash/parser"
4
+ require "geomash/standardizer"
5
+ require "geomash/tgn"
6
+ require "geomash/geonames"
7
+ require "geomash/town_lookup"
8
+ require "geocoder"
9
+ require "countries"
10
+ require "unidecoder"
11
+ require "typhoeus"
12
+ require "nokogiri"
13
+ require "htmlentities"
14
+ require "active_support/core_ext/string/filters"
15
+ require "active_support/hash_with_indifferent_access"
16
+
17
+ def self.config
18
+ @config ||= YAML::load(File.open(config_path))[env]
19
+ .with_indifferent_access
20
+ end
21
+
22
+ def self.app_root
23
+ return @app_root if @app_root
24
+ @app_root = Rails.root if defined?(Rails) and defined?(Rails.root)
25
+ @app_root ||= APP_ROOT if defined?(APP_ROOT)
26
+ @app_root ||= '.'
27
+ end
28
+
29
+ def self.env
30
+ return @env if @env
31
+ @env = ENV["RAILS_ENV"] = "test" if ENV
32
+ @env ||= Rails.env if defined?(Rails) and defined?(Rails.root)
33
+ @env ||= 'development'
34
+ end
35
+
36
+ def self.config_path
37
+ File.join(app_root, 'config', 'geomash.yml')
38
+ end
39
+
40
+ def self.parse(term,parse_term=false)
41
+ return {} if term.blank?
42
+
43
+ return_hash = Geomash::Parser.parse_mapquest_api(term, parse_term)
44
+
45
+ if return_hash.blank?
46
+ return_hash = Geomash::Parser.parse_bing_api(term, parse_term)
47
+ end
48
+
49
+ if return_hash.blank?
50
+ return_hash = Geomash::Parser.parse_google_api(term, parse_term)
51
+ end
52
+
53
+ if return_hash[:country_part].present?
54
+ #FIXME
55
+ return_hash[:tgn] = Geomash::TGN.tgn_id_from_geo_hash(return_hash)
56
+
57
+ if return_hash[:tgn].blank?
58
+ geo_hash_temp = Geomash::Standardizer.try_with_entered_names(return_hash)
59
+ return_hash[:tgn] = Geomash::TGN.tgn_id_from_geo_hash(geo_hash_temp) if geo_hash_temp.present?
60
+
61
+ if return_hash[:tgn].blank? && return_hash[:neighborhood_part].present?
62
+
63
+ geo_hash_temp = return_hash.clone
64
+ geo_hash_temp[:neighborhood_part] = nil
65
+ geo_hash_temp[:original_string_differs] = true
66
+ return_hash[:tgn] = Geomash::TGN.tgn_id_from_geo_hash(geo_hash_temp)
67
+ return_hash[:tgn][:original_string_differs] = true if return_hash[:tgn].present?
68
+ elsif return_hash[:city_part].present? && return_hash[:tgn].blank?
69
+
70
+ geo_hash_temp = return_hash.clone
71
+ geo_hash_temp[:city_part] = nil
72
+ geo_hash_temp[:original_string_differs] = true
73
+ return_hash[:tgn] = Geomash::TGN.tgn_id_from_geo_hash(geo_hash_temp)
74
+ return_hash[:tgn][:original_string_differs] = true if return_hash[:tgn].present?
75
+
76
+ end
77
+
78
+ end
79
+
80
+ return_hash[:geonames] = Geomash::Geonames.geonames_id_from_geo_hash(return_hash)
81
+ end
82
+
83
+ return return_hash
84
+
85
+ end
86
+ end
@@ -0,0 +1,478 @@
1
+ module Geomash
2
+ class Constants
3
+ COUNTRY_TGN_LOOKUP = {}
4
+ COUNTRY_TGN_LOOKUP['United States'] = {:tgn_id=>7012149, :tgn_country_name=>'United States'}
5
+ COUNTRY_TGN_LOOKUP['Canada'] = {:tgn_id=>7005685, :tgn_country_name=>'Canada'}
6
+ COUNTRY_TGN_LOOKUP['France'] = {:tgn_id=>1000070, :tgn_country_name=>'France'}
7
+ COUNTRY_TGN_LOOKUP['Vietnam'] = {:tgn_id=>1000145, :tgn_country_name=>'Viet Nam'}
8
+ COUNTRY_TGN_LOOKUP['South Africa'] = {:tgn_id=>1000193, :tgn_country_name=>'South Africa'}
9
+ COUNTRY_TGN_LOOKUP['Philippines'] = {:tgn_id=>1000135, :tgn_country_name=>'Pilipinas'}
10
+ COUNTRY_TGN_LOOKUP['China'] = {:tgn_id=>1000111, :tgn_country_name=>'Zhongguo'}
11
+ COUNTRY_TGN_LOOKUP['Japan'] = {:tgn_id=>1000120, :tgn_country_name=>'Nihon'}
12
+
13
+ STATE_ABBR = {
14
+ 'AL' => 'Alabama',
15
+ 'AK' => 'Alaska',
16
+ 'AS' => 'America Samoa',
17
+ 'AZ' => 'Arizona',
18
+ 'AR' => 'Arkansas',
19
+ 'CA' => 'California',
20
+ 'CO' => 'Colorado',
21
+ 'CT' => 'Connecticut',
22
+ 'DE' => 'Delaware',
23
+ 'DC' => 'District of Columbia',
24
+ 'FM' => 'Micronesia1',
25
+ 'FL' => 'Florida',
26
+ 'GA' => 'Georgia',
27
+ 'GU' => 'Guam',
28
+ 'HI' => 'Hawaii',
29
+ 'ID' => 'Idaho',
30
+ 'IL' => 'Illinois',
31
+ 'IN' => 'Indiana',
32
+ 'IA' => 'Iowa',
33
+ 'KS' => 'Kansas',
34
+ 'KY' => 'Kentucky',
35
+ 'LA' => 'Louisiana',
36
+ 'ME' => 'Maine',
37
+ 'MH' => 'Islands1',
38
+ 'MD' => 'Maryland',
39
+ 'MA' => 'Massachusetts',
40
+ 'MI' => 'Michigan',
41
+ 'MN' => 'Minnesota',
42
+ 'MS' => 'Mississippi',
43
+ 'MO' => 'Missouri',
44
+ 'MT' => 'Montana',
45
+ 'NE' => 'Nebraska',
46
+ 'NV' => 'Nevada',
47
+ 'NH' => 'New Hampshire',
48
+ 'NJ' => 'New Jersey',
49
+ 'NM' => 'New Mexico',
50
+ 'NY' => 'New York',
51
+ 'NC' => 'North Carolina',
52
+ 'ND' => 'North Dakota',
53
+ 'OH' => 'Ohio',
54
+ 'OK' => 'Oklahoma',
55
+ 'OR' => 'Oregon',
56
+ 'PW' => 'Palau',
57
+ 'PA' => 'Pennsylvania',
58
+ 'PR' => 'Puerto Rico',
59
+ 'RI' => 'Rhode Island',
60
+ 'SC' => 'South Carolina',
61
+ 'SD' => 'South Dakota',
62
+ 'TN' => 'Tennessee',
63
+ 'TX' => 'Texas',
64
+ 'UT' => 'Utah',
65
+ 'VT' => 'Vermont',
66
+ 'VI' => 'Virgin Island',
67
+ 'VA' => 'Virginia',
68
+ 'WA' => 'Washington',
69
+ 'WV' => 'West Virginia',
70
+ 'WI' => 'Wisconsin',
71
+ 'WY' => 'Wyoming'
72
+ }
73
+
74
+ #Terms that drive geographic parsers mad...
75
+ JUNK_TERMS = [
76
+ 'Cranberries',
77
+ 'History',
78
+ 'Maps',
79
+ 'State Police',
80
+ 'Pictorial works.',
81
+ /[nN]ation/,
82
+ 'Asia',
83
+ '(Republic)'
84
+ ]
85
+
86
+
87
+ STATE_TOWN_TGN_IDS =
88
+ {:MA => [
89
+ {:location_name => "Abington", :tgn_id => "2049291"},
90
+ {:location_name => "Acton", :tgn_id => "7015054"},
91
+ {:location_name => "Acushnet", :tgn_id => "2049300"},
92
+ {:location_name => "North Adams", :tgn_id => "7014234"},
93
+ {:location_name => "Adams", :tgn_id => "2049304"},
94
+ {:location_name => "Agawam", :tgn_id => "2049310"},
95
+ {:location_name => "Alford", :tgn_id => "2049314"},
96
+ {:location_name => "Allston", :tgn_id => "1003950"},
97
+ {:location_name => "Amesbury", :tgn_id => "2049316"},
98
+ {:location_name => "Amherst", :tgn_id => "7013296"},
99
+ {:location_name => "North Andover", :tgn_id => "7014236"},
100
+ {:location_name => "Andover", :tgn_id => "7013301"},
101
+ {:location_name => "Aquinnah", :tgn_id => "2049808"},
102
+ {:location_name => "Arlington", :tgn_id => "7013320"},
103
+ {:location_name => "Ashburnham", :tgn_id => "2049328"},
104
+ {:location_name => "Ashby", :tgn_id => "2049329"},
105
+ {:location_name => "Ashfield", :tgn_id => "2049331"},
106
+ {:location_name => "Ashland", :tgn_id => "2049332"},
107
+ {:location_name => "Athol", :tgn_id => "7020033"},
108
+ {:location_name => "North Attleborough", :tgn_id => "2050251"},
109
+ {:location_name => "North Attleboro", :tgn_id => "2050251"},
110
+ {:location_name => "Attleboro", :tgn_id => "2049344"},
111
+ {:location_name => "Auburndale", :tgn_id => "2050216"},
112
+ {:location_name => "Auburn", :tgn_id => "2049349"},
113
+ {:location_name => "Avon", :tgn_id => "2049358"},
114
+ {:location_name => "Ayer", :tgn_id => "2049359"},
115
+ {:location_name => "Babson Park", :tgn_id => "2050853"},
116
+ {:location_name => "Back Bay", :tgn_id => "1004027"},
117
+ {:location_name => "Barnstable", :tgn_id => "7014989"},
118
+ {:location_name => "Barre", :tgn_id => "2049368"},
119
+ {:location_name => "Bass River", :tgn_id => "2050679"},
120
+ {:location_name => "Beacon Hill", :tgn_id => "7015000"},
121
+ {:location_name => "Becket", :tgn_id => "2049376"},
122
+ {:location_name => "New Bedford", :tgn_id => "7014196"},
123
+ {:location_name => "Bedford", :tgn_id => "2049378"},
124
+ {:location_name => "Belchertown", :tgn_id => "2049383"},
125
+ {:location_name => "Bellingham", :tgn_id => "2049385"},
126
+ {:location_name => "Belmont", :tgn_id => "7013377"},
127
+ {:location_name => "Berkley", :tgn_id => "2049406"},
128
+ {:location_name => "Berlin", :tgn_id => "2049409"},
129
+ {:location_name => "Bernardston", :tgn_id => "2049410"},
130
+ {:location_name => "Beverly", :tgn_id => "7013417"},
131
+ {:location_name => "Billerica", :tgn_id => "2049421"},
132
+ {:location_name => "Blackstone", :tgn_id => "2049422"},
133
+ {:location_name => "Blandford", :tgn_id => "2049426"},
134
+ {:location_name => "Bolton", :tgn_id => "2049429"},
135
+ {:location_name => "East Boston", :tgn_id => "7015009"},
136
+ {:location_name => "South Boston", :tgn_id => "7015007"},
137
+ {:location_name => "Boston", :tgn_id => "7013445"},
138
+ {:location_name => "Bourne", :tgn_id => "2049495"},
139
+ {:location_name => "Boxborough", :tgn_id => "2049500"},
140
+ {:location_name => "Boxford", :tgn_id => "2049501"},
141
+ {:location_name => "West Boylston", :tgn_id => "2050876"},
142
+ {:location_name => "Boylston", :tgn_id => "2049505"},
143
+ {:location_name => "New Braintree", :tgn_id => "2050203"},
144
+ {:location_name => "Braintree", :tgn_id => "2049507"},
145
+ {:location_name => "Bradford", :tgn_id => "2049888"},
146
+ {:location_name => "Brewster", :tgn_id => "7013452"},
147
+ {:location_name => "East Bridgewater", :tgn_id => "7015082"},
148
+ {:location_name => "West Bridgewater", :tgn_id => "2050877"},
149
+ {:location_name => "Bridgewater", :tgn_id => "2049517"},
150
+ {:location_name => "Brighton", :tgn_id => "1004167"},
151
+ {:location_name => "Brimfield", :tgn_id => "2049519"},
152
+ {:location_name => "Brockton", :tgn_id => "7013455"},
153
+ {:location_name => "East Brookfield", :tgn_id => "2049698"},
154
+ {:location_name => "North Brookfield", :tgn_id => "2050260"},
155
+ {:location_name => "West Brookfield", :tgn_id => "2050882"},
156
+ {:location_name => "Brookfield", :tgn_id => "2049525"},
157
+ {:location_name => "Brookline", :tgn_id => "7013458"},
158
+ {:location_name => "Buckland", :tgn_id => "2049538"},
159
+ {:location_name => "Burlington", :tgn_id => "2049542"},
160
+ {:location_name => "Buzzards Bay", :tgn_id => "2049546"},
161
+ {:location_name => "Cambridge", :tgn_id => "7013527"},
162
+ {:location_name => "Canton", :tgn_id => "2049559"},
163
+ {:location_name => "Carlisle", :tgn_id => "2049564"},
164
+ {:location_name => "Carver", :tgn_id => "2049565"},
165
+ {:location_name => "Centerville", :tgn_id => "2049570"},
166
+ {:location_name => "Charlemont", :tgn_id => "2049576"},
167
+ {:location_name => "Charlestown", :tgn_id => "7015010"},
168
+ {:location_name => "Charlton", :tgn_id => "2049577"},
169
+ {:location_name => "Chatham", :tgn_id => "7013586"},
170
+ {:location_name => "Chelmsford", :tgn_id => "7013588"},
171
+ {:location_name => "Chelsea", :tgn_id => "7015012"},
172
+ {:location_name => "Cheshire", :tgn_id => "2049591"},
173
+ {:location_name => "Chesterfield", :tgn_id => "2049595"},
174
+ {:location_name => "Chester", :tgn_id => "2049593"},
175
+ {:location_name => "Chestnut Hill", :tgn_id => "7032056"},
176
+ {:location_name => "Chicopee", :tgn_id => "2049596"},
177
+ {:location_name => "Chilmark", :tgn_id => "7013601"},
178
+ {:location_name => "Clinton", :tgn_id => "2049616"},
179
+ {:location_name => "Cohasset", :tgn_id => "2049619"},
180
+ {:location_name => "Colrain", :tgn_id => "2049625"},
181
+ {:location_name => "Concord", :tgn_id => "7013646"},
182
+ {:location_name => "Conway", :tgn_id => "2049630"},
183
+ {:location_name => "Cummington", :tgn_id => "2049642"},
184
+ {:location_name => "Dalton", :tgn_id => "2049645"},
185
+ {:location_name => "Danvers", :tgn_id => "2049648"},
186
+ {:location_name => "Dartmouth", :tgn_id => "2049654"},
187
+ {:location_name => "Dedham", :tgn_id => "7013518"},
188
+ {:location_name => "Deerfield", :tgn_id => "7013521"},
189
+ {:location_name => "Dennis Port", :tgn_id => "2049668"},
190
+ {:location_name => "Dennis", :tgn_id => "2049667"},
191
+ {:location_name => "Devens", :tgn_id => "7022168"},
192
+ {:location_name => "Dighton", :tgn_id => "2049669"},
193
+ {:location_name => "Douglas", :tgn_id => "2049674"},
194
+ {:location_name => "Dorchester", :tgn_id => "7013575"},
195
+ {:location_name => "Dover", :tgn_id => "2049675"},
196
+ {:location_name => "Dracut", :tgn_id => "2049676"},
197
+ {:location_name => "Dudley", :tgn_id => "2049682"},
198
+ {:location_name => "Dunstable", :tgn_id => "2049687"},
199
+ {:location_name => "Duxbury", :tgn_id => "7013627"},
200
+ {:location_name => "East Longmeadow", :tgn_id => "2049719"},
201
+ {:location_name => "East Walpole", :tgn_id => "2049737"},
202
+ {:location_name => "Easthampton", :tgn_id => "2049712"},
203
+ {:location_name => "Eastham", :tgn_id => "2049711"},
204
+ {:location_name => "Easton", :tgn_id => "2049724"},
205
+ {:location_name => "Edgartown", :tgn_id => "2049741"},
206
+ {:location_name => "Egremont Plain", :tgn_id => "2312102"},
207
+ {:location_name => "North Egremont", :tgn_id => "2050281"},
208
+ {:location_name => "South Egremont", :tgn_id => "2050634"},
209
+ {:location_name => "Erving", :tgn_id => "2049751"},
210
+ {:location_name => "Essex", :tgn_id => "2049752"},
211
+ {:location_name => "Everett", :tgn_id => "2049753"},
212
+ {:location_name => "Fairhaven", :tgn_id => "2049755"},
213
+ {:location_name => "Fall River", :tgn_id => "7014164"},
214
+ {:location_name => "Falmouth", :tgn_id => "2049768"},
215
+ {:location_name => "Fitchburg", :tgn_id => "7013763"},
216
+ {:location_name => "Florida", :tgn_id => "2049782"},
217
+ {:location_name => "Foxborough", :tgn_id => "2049790"},
218
+ {:location_name => "Framingham", :tgn_id => "7013936"},
219
+ {:location_name => "Franklin", :tgn_id => "2049799"},
220
+ {:location_name => "Freetown", :tgn_id => "2049336"},
221
+ {:location_name => "Gardner", :tgn_id => "2049807"},
222
+ {:location_name => "Gay Head", :tgn_id => "2049808"},
223
+ {:location_name => "Georgetown", :tgn_id => "2049809"},
224
+ {:location_name => "Gill", :tgn_id => "2349466"},
225
+ {:location_name => "Gloucester", :tgn_id => "7014073"},
226
+ {:location_name => "Goshen", :tgn_id => "2049834"},
227
+ {:location_name => "Gosnold", :tgn_id => "2356954"},
228
+ {:location_name => "Grafton", :tgn_id => "7014078"},
229
+ {:location_name => "Granby", :tgn_id => "2049838"},
230
+ {:location_name => "Granville", :tgn_id => "2049840"},
231
+ {:location_name => "Great Barrington", :tgn_id => "2049843"},
232
+ {:location_name => "Greenfield", :tgn_id => "7014134"},
233
+ {:location_name => "Groton", :tgn_id => "2049856"},
234
+ {:location_name => "Groveland", :tgn_id => "2049857"},
235
+ {:location_name => "South Hadley", :tgn_id => "7014518"},
236
+ {:location_name => "Hadley", :tgn_id => "2049858"},
237
+ {:location_name => "Halifax", :tgn_id => "2049862"},
238
+ {:location_name => "Hamilton", :tgn_id => "2049865"},
239
+ {:location_name => "Hampden", :tgn_id => "2049866"},
240
+ {:location_name => "Hancock", :tgn_id => "7013688"},
241
+ {:location_name => "Hanover", :tgn_id => "2049868"},
242
+ {:location_name => "Hanson", :tgn_id => "2049871"},
243
+ {:location_name => "Hardwick", :tgn_id => "2049874"},
244
+ {:location_name => "Harvard", :tgn_id => "7015083"},
245
+ {:location_name => "Harwich", :tgn_id => "2049879"},
246
+ {:location_name => "Hatfield", :tgn_id => "2049884"},
247
+ {:location_name => "Haverhill", :tgn_id => "2049885"},
248
+ {:location_name => "Hawley", :tgn_id => "2049892"},
249
+ {:location_name => "Heath", :tgn_id => "2049895"},
250
+ {:location_name => "Hingham", :tgn_id => "2049904"},
251
+ {:location_name => "Hinsdale", :tgn_id => "2049909"},
252
+ {:location_name => "Holbrook", :tgn_id => "2049911"},
253
+ {:location_name => "Holden", :tgn_id => "2049914"},
254
+ {:location_name => "Holland", :tgn_id => "2049915"},
255
+ {:location_name => "Holliston", :tgn_id => "2049916"},
256
+ {:location_name => "Holyoke", :tgn_id => "7013717"},
257
+ {:location_name => "Hopedale", :tgn_id => "7013720"},
258
+ {:location_name => "Hopkinton", :tgn_id => "2049941"},
259
+ {:location_name => "Housatonic", :tgn_id => "2049945"},
260
+ {:location_name => "Hubbardston", :tgn_id => "2049947"},
261
+ {:location_name => "Hudson", :tgn_id => "2049950"},
262
+ {:location_name => "Hull", :tgn_id => "2049951"},
263
+ {:location_name => "Huntington", :tgn_id => "2049955"},
264
+ {:location_name => "Hyannis", :tgn_id => "2049957"},
265
+ {:location_name => "Hyde Park", :tgn_id => "7015004"},
266
+ {:location_name => "Ipswich", :tgn_id => "2049964"},
267
+ {:location_name => "Jamaica Plain", :tgn_id => "7015005"},
268
+ {:location_name => "Kingston", :tgn_id => "2049971"},
269
+ {:location_name => "Lakeville", :tgn_id => "2049981"},
270
+ {:location_name => "Lancaster", :tgn_id => "2049989"},
271
+ {:location_name => "Lanesborough", :tgn_id => "2049990"},
272
+ {:location_name => "Lawrence", :tgn_id => "2049994"},
273
+ {:location_name => "Lee", :tgn_id => "2049998"},
274
+ {:location_name => "Leicester", :tgn_id => "2050001"},
275
+ {:location_name => "Lenox", :tgn_id => "7016268"},
276
+ {:location_name => "Leominster", :tgn_id => "2050006"},
277
+ {:location_name => "Leverett", :tgn_id => "7015079"},
278
+ {:location_name => "Lexington", :tgn_id => "7013888"},
279
+ {:location_name => "Leyden", :tgn_id => "2446784"},
280
+ {:location_name => "Lincoln", :tgn_id => "7013891"},
281
+ {:location_name => "Littleton", :tgn_id => "2050022"},
282
+ {:location_name => "Longmeadow", :tgn_id => "2050026"},
283
+ {:location_name => "Lowell", :tgn_id => "7013975"},
284
+ {:location_name => "Ludlow", :tgn_id => "7013977"},
285
+ {:location_name => "Lunenburg", :tgn_id => "2050041"},
286
+ {:location_name => "Lynnfield", :tgn_id => "2050046"},
287
+ {:location_name => "Lynn", :tgn_id => "2050042"},
288
+ {:location_name => "Magnolia", :tgn_id => "2049826"},
289
+ {:location_name => "Malden", :tgn_id => "7013986"},
290
+ {:location_name => "Manchester-by-the-Sea", :tgn_id => "2050062"},
291
+ {:location_name => "Mansfield", :tgn_id => "2050071"},
292
+ {:location_name => "Marblehead", :tgn_id => "7013997"},
293
+ {:location_name => "Marion", :tgn_id => "2050076"},
294
+ {:location_name => "New Marlborough", :tgn_id => "2050209"},
295
+ {:location_name => "Marlborough", :tgn_id => "2050078"},
296
+ {:location_name => "Marshfield", :tgn_id => "2050079"},
297
+ {:location_name => "Mashpee", :tgn_id => "2050083"},
298
+ {:location_name => "Mattapan", :tgn_id => "7015006"},
299
+ {:location_name => "Mattapoisett", :tgn_id => "2050089"},
300
+ {:location_name => "Maynard", :tgn_id => "2050092"},
301
+ {:location_name => "Medfield", :tgn_id => "7014022"},
302
+ {:location_name => "Medford", :tgn_id => "7014023"},
303
+ {:location_name => "Medway", :tgn_id => "2050102"},
304
+ {:location_name => "Melrose", :tgn_id => "2050105"},
305
+ {:location_name => "Mendon", :tgn_id => "2050109"},
306
+ {:location_name => "Menemsha", :tgn_id => "2050110"},
307
+ {:location_name => "Merrimac", :tgn_id => "2050111"},
308
+ {:location_name => "Methuen", :tgn_id => "2050114"},
309
+ {:location_name => "Middleborough", :tgn_id => "2050120"},
310
+ {:location_name => "Middlefield", :tgn_id => "2050121"},
311
+ {:location_name => "Middleton", :tgn_id => "2050123"},
312
+ {:location_name => "Milford", :tgn_id => "2050128"},
313
+ {:location_name => "Millbury", :tgn_id => "2050133"},
314
+ {:location_name => "Millis", :tgn_id => "2050137"},
315
+ {:location_name => "Millville", :tgn_id => "2050142"},
316
+ {:location_name => "Milton", :tgn_id => "7014069"},
317
+ {:location_name => "Monson", :tgn_id => "2050157"},
318
+ {:location_name => "Montague", :tgn_id => "2050158"},
319
+ {:location_name => "Monterey", :tgn_id => "2050159"},
320
+ {:location_name => "Montgomery", :tgn_id => "2050160"},
321
+ {:location_name => "Mount Washington", :tgn_id => "2050167"},
322
+ {:location_name => "Nahant", :tgn_id => "7014178"},
323
+ {:location_name => "Nantucket", :tgn_id => "7014179"},
324
+ {:location_name => "Natick", :tgn_id => "7014190"},
325
+ {:location_name => "Needham", :tgn_id => "2050190"},
326
+ {:location_name => "New Ashford", :tgn_id => "2050194"},
327
+ {:location_name => "New Salem", :tgn_id => "2050210"},
328
+ {:location_name => "New Seabury", :tgn_id => "2050211"},
329
+ {:location_name => "Newburyport", :tgn_id => "7014220"},
330
+ {:location_name => "West Newbury", :tgn_id => "2050913"},
331
+ {:location_name => "Newbury", :tgn_id => "7014219"},
332
+ {:location_name => "Newton", :tgn_id => "2050214"},
333
+ {:location_name => "Norfolk", :tgn_id => "2050231"},
334
+ {:location_name => "North End", :tgn_id => "2545160"},
335
+ {:location_name => "North Reading", :tgn_id => "2050315"},
336
+ {:location_name => "Northampton", :tgn_id => "7014242"},
337
+ {:location_name => "Northborough", :tgn_id => "2050257"},
338
+ {:location_name => "Northbridge", :tgn_id => "2050258"},
339
+ {:location_name => "Northfield", :tgn_id => "2050286"},
340
+ {:location_name => "Norton", :tgn_id => "7014245"},
341
+ {:location_name => "Norwell", :tgn_id => "2050332"},
342
+ {:location_name => "Norwood", :tgn_id => "2050333"},
343
+ {:location_name => "Oak Bluffs", :tgn_id => "7014249"},
344
+ {:location_name => "Oakham", :tgn_id => "2050347"},
345
+ {:location_name => "Orange", :tgn_id => "2050360"},
346
+ {:location_name => "Orleans", :tgn_id => "2050361"},
347
+ {:location_name => "Otis", :tgn_id => "2050364"},
348
+ {:location_name => "Oxford", :tgn_id => "2050367"},
349
+ {:location_name => "Palmer", :tgn_id => "2050372"},
350
+ {:location_name => "Paxton", :tgn_id => "2050374"},
351
+ {:location_name => "Peabody", :tgn_id => "7014394"},
352
+ {:location_name => "Pelham", :tgn_id => "2050382"},
353
+ {:location_name => "Pembroke", :tgn_id => "2050383"},
354
+ {:location_name => "Pepperell", :tgn_id => "2050384"},
355
+ {:location_name => "Peru", :tgn_id => "2050386"},
356
+ {:location_name => "Petersham", :tgn_id => "2050387"},
357
+ {:location_name => "Phillipston", :tgn_id => "2050388"},
358
+ {:location_name => "Pittsfield", :tgn_id => "7014416"},
359
+ {:location_name => "Plainfield", :tgn_id => "2050417"},
360
+ {:location_name => "Plainville", :tgn_id => "2050418"},
361
+ {:location_name => "Plymouth", :tgn_id => "7014421"},
362
+ {:location_name => "Plympton", :tgn_id => "2050427"},
363
+ {:location_name => "Princeton", :tgn_id => "2050443"},
364
+ {:location_name => "Provincetown", :tgn_id => "7015018"},
365
+ {:location_name => "Quincy", :tgn_id => "7014307"},
366
+ {:location_name => "Randolph", :tgn_id => "2050469"},
367
+ {:location_name => "Raynham", :tgn_id => "2050472"},
368
+ {:location_name => "Reading", :tgn_id => "7014313"},
369
+ {:location_name => "Rehoboth", :tgn_id => "2050475"},
370
+ {:location_name => "Revere", :tgn_id => "2050476"},
371
+ {:location_name => "Richmond", :tgn_id => "2050487"},
372
+ {:location_name => "Rochester", :tgn_id => "2050497"},
373
+ {:location_name => "Rockland", :tgn_id => "2050501"},
374
+ {:location_name => "Rockport", :tgn_id => "2050502"},
375
+ {:location_name => "Roslindale", :tgn_id => "1005467"},
376
+ {:location_name => "West Roxbury", :tgn_id => "7015008"},
377
+ {:location_name => "Roxbury", :tgn_id => "7015002"},
378
+ {:location_name => "Rowe", :tgn_id => "2050507"},
379
+ {:location_name => "Rowley", :tgn_id => "2050508"},
380
+ {:location_name => "Royalston", :tgn_id => "2050509"},
381
+ {:location_name => "Russell", :tgn_id => "2050510"},
382
+ {:location_name => "Rutland", :tgn_id => "2050512"},
383
+ {:location_name => "Sagamore", :tgn_id => "2050514"},
384
+ {:location_name => "Salem", :tgn_id => "7014447"},
385
+ {:location_name => "Salisbury", :tgn_id => "2050528"},
386
+ {:location_name => "Sandisfield", :tgn_id => "2050536"},
387
+ {:location_name => "Sandwich", :tgn_id => "7014468"},
388
+ {:location_name => "Saugus", :tgn_id => "2050540"},
389
+ {:location_name => "Savoy", :tgn_id => "2050549"},
390
+ {:location_name => "Scituate", :tgn_id => "2050550"},
391
+ {:location_name => "Seekonk", :tgn_id => "2050559"},
392
+ {:location_name => "Sharon", :tgn_id => "2050563"},
393
+ {:location_name => "Sheffield", :tgn_id => "2050571"},
394
+ {:location_name => "Shelburne", :tgn_id => "2050572"},
395
+ {:location_name => "Sherborn", :tgn_id => "2050576"},
396
+ {:location_name => "Shirley", :tgn_id => "2050579"},
397
+ {:location_name => "Shrewsbury", :tgn_id => "2050583"},
398
+ {:location_name => "Shutesbury", :tgn_id => "2050589"},
399
+ {:location_name => "Somerset", :tgn_id => "2050597"},
400
+ {:location_name => "Somerville", :tgn_id => "2050602"},
401
+ {:location_name => "South End", :tgn_id => "2677860"},
402
+ {:location_name => "Southampton", :tgn_id => "2050609"},
403
+ {:location_name => "Southborough", :tgn_id => "2050615"},
404
+ {:location_name => "Southbridge", :tgn_id => "2050617"},
405
+ {:location_name => "Southwick", :tgn_id => "2050674"},
406
+ {:location_name => "Spencer", :tgn_id => "2050680"},
407
+ {:location_name => "West Springfield", :tgn_id => "2050928"},
408
+ {:location_name => "Springfield", :tgn_id => "7014531"},
409
+ {:location_name => "Sterling", :tgn_id => "2050698"},
410
+ {:location_name => "West Stockbridge", :tgn_id => "2050932"},
411
+ {:location_name => "Stockbridge", :tgn_id => "7014544"},
412
+ {:location_name => "Stoneham", :tgn_id => "2050706"},
413
+ {:location_name => "Stoughton", :tgn_id => "2050712"},
414
+ {:location_name => "Stow", :tgn_id => "2050719"},
415
+ {:location_name => "Sturbridge", :tgn_id => "7014553"},
416
+ {:location_name => "Sudbury", :tgn_id => "2050723"},
417
+ {:location_name => "Sunderland", :tgn_id => "2050725"},
418
+ {:location_name => "Sutton", :tgn_id => "2050727"},
419
+ {:location_name => "Swampscott", :tgn_id => "2050728"},
420
+ {:location_name => "Swansea", :tgn_id => "2050729"},
421
+ {:location_name => "Taunton", :tgn_id => "7014569"},
422
+ {:location_name => "Templeton", :tgn_id => "2050746"},
423
+ {:location_name => "Tewksbury", :tgn_id => "2050747"},
424
+ {:location_name => "West Tisbury", :tgn_id => "2050935"},
425
+ {:location_name => "Tolland", :tgn_id => "2050758"},
426
+ {:location_name => "Topsfield", :tgn_id => "7014379"},
427
+ {:location_name => "Townsend", :tgn_id => "2050764"},
428
+ {:location_name => "Truro", :tgn_id => "2050766"},
429
+ {:location_name => "Tyngsborough", :tgn_id => "2050772"},
430
+ {:location_name => "Tyringham", :tgn_id => "2050773"},
431
+ {:location_name => "Upton", :tgn_id => "2050775"},
432
+ {:location_name => "Uxbridge", :tgn_id => "2050777"},
433
+ {:location_name => "Vineyard Haven", :tgn_id => "2050781"},
434
+ {:location_name => "Waban", :tgn_id => "2050226"},
435
+ {:location_name => "Wakefield", :tgn_id => "2050785"},
436
+ {:location_name => "Wales", :tgn_id => "2050790"},
437
+ {:location_name => "Walpole", :tgn_id => "2050791"},
438
+ {:location_name => "Waltham", :tgn_id => "7014579"},
439
+ {:location_name => "Ware", :tgn_id => "2050814"},
440
+ {:location_name => "Wareham", :tgn_id => "2050815"},
441
+ {:location_name => "Warren", :tgn_id => "2050821"},
442
+ {:location_name => "Warwick", :tgn_id => "2050824"},
443
+ {:location_name => "Washington", :tgn_id => "2050825"},
444
+ {:location_name => "Watertown", :tgn_id => "7014591"},
445
+ {:location_name => "Wayland", :tgn_id => "2050839"},
446
+ {:location_name => "Webster", :tgn_id => "2050841"},
447
+ {:location_name => "Wellesley", :tgn_id => "7014604"},
448
+ {:location_name => "Wellfleet", :tgn_id => "2050858"},
449
+ {:location_name => "Wendell", :tgn_id => "2050862"},
450
+ {:location_name => "Wenham", :tgn_id => "2050864"},
451
+ {:location_name => "Westborough", :tgn_id => "2050874"},
452
+ {:location_name => "Westfield", :tgn_id => "7014614"},
453
+ {:location_name => "Westford", :tgn_id => "2050896"},
454
+ {:location_name => "Westhampton", :tgn_id => "2050900"},
455
+ {:location_name => "Westminster", :tgn_id => "7015084"},
456
+ {:location_name => "Weston", :tgn_id => "7014617"},
457
+ {:location_name => "Westport", :tgn_id => "2050924"},
458
+ {:location_name => "Westwood", :tgn_id => "7016328"},
459
+ {:location_name => "Weymouth", :tgn_id => "2050948"},
460
+ {:location_name => "Whately", :tgn_id => "2050958"},
461
+ {:location_name => "Whitman", :tgn_id => "2050968"},
462
+ {:location_name => "Wilbraham", :tgn_id => "2050969"},
463
+ {:location_name => "Williamsburg", :tgn_id => "2050971"},
464
+ {:location_name => "Williamstown", :tgn_id => "7014630"},
465
+ {:location_name => "Wilmington", :tgn_id => "2050977"},
466
+ {:location_name => "Winchendon", :tgn_id => "7014634"},
467
+ {:location_name => "Winchester", :tgn_id => "7014635"},
468
+ {:location_name => "Windsor", :tgn_id => "2050987"},
469
+ {:location_name => "Winthrop", :tgn_id => "2050990"},
470
+ {:location_name => "Woburn", :tgn_id => "2051000"},
471
+ {:location_name => "Woods Hole", :tgn_id => "2051007"},
472
+ {:location_name => "Worcester", :tgn_id => "7014647"},
473
+ {:location_name => "Worthington", :tgn_id => "2051048"},
474
+ {:location_name => "Wrentham", :tgn_id => "2051050"},
475
+ {:location_name => "Yarmouth", :tgn_id => "2051052"}
476
+ ]}
477
+ end
478
+ end