From: Tom Hughes Date: Fri, 17 Jan 2014 19:25:58 +0000 (+0000) Subject: Replace the country table with a static XML countries file X-Git-Tag: live~5074 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/42b329ed82c7899b970e1f0fd8d6d29fd625f7d5 Replace the country table with a static XML countries file Storing the countries in the database is overkill, so just use a copy of the geonames countryInfo data that is loaded into a hash the first time it is used. --- diff --git a/app/models/country.rb b/app/models/country.rb deleted file mode 100644 index b7cec2b68..000000000 --- a/app/models/country.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Country < ActiveRecord::Base -end diff --git a/config/countries.xml b/config/countries.xml new file mode 100644 index 000000000..34082dd25 --- /dev/null +++ b/config/countries.xml @@ -0,0 +1,4753 @@ + + + +AD +Andorra +020 +AND +AN +EU +Europe +Andorra la Vella +468.0 +84000 +EUR +ca +3041565 +1.4071867141112762 +42.65604389629997 +1.7865427778319827 +42.42849259876837 + + +AE +United Arab Emirates +784 +ARE +AE +AS +Asia +Abu Dhabi +82880.0 +4975593 +AED +ar-AE,fa,en,hi,ur +290557 +51.58332824707031 +26.08415985107422 +56.38166046142578 +22.633329391479492 + + +AF +Afghanistan +004 +AFG +AF +AS +Asia +Kabul +647500.0 +29121286 +AFN +fa-AF,ps,uz-AF,tk +1149361 +60.478443 +38.483418 +74.879448 +29.377472 + + +AG +Antigua and Barbuda +028 +ATG +AC +NA +North America +St. John's +443.0 +86754 +XCD +en-AG +3576396 +-61.906425 +17.729387 +-61.672421 +16.996979 + + +AI +Anguilla +660 +AIA +AV +NA +North America +The Valley +102.0 +13254 +XCD +en-AI +3573511 +-63.172901 +18.283424 +-62.971359 +18.166815 + + +AL +Albania +008 +ALB +AL +EU +Europe +Tirana +28748.0 +2986952 +ALL +sq,el +783754 +19.293972 +42.665611 +21.068472 +39.648361 + + +AM +Armenia +051 +ARM +AM +AS +Asia +Yerevan +29800.0 +2968000 +AMD +hy +174982 +43.44978 +41.301834 +46.772435045159995 +38.830528 + + +AO +Angola +024 +AGO +AO +AF +Africa +Luanda +1246700.0 +13068161 +AOA +pt-AO +3351879 +11.679219 +-4.376826 +24.082119 +-18.042076 + + +AQ +Antarctica +010 +ATA +AY +AN +Antarctica + +1.4E7 +0 + + +6697173 +-179.9999 +-60.515533 +179.9999 +-89.9999 + + +AR +Argentina +032 +ARG +AR +SA +South America +Buenos Aires +2766890.0 +41343201 +ARS +es-AR,en,it,de,fr,gn +3865483 +-73.58297 +-21.781277 +-53.591835 +-55.061314 + + +AS +American Samoa +016 +ASM +AQ +OC +Oceania +Pago Pago +199.0 +57881 +USD +en-AS,sm,to +5880801 +-171.091888 +-11.0497 +-169.416077 +-14.382478 + + +AT +Austria +040 +AUT +AU +EU +Europe +Vienna +83858.0 +8205000 +EUR +de-AT,hr,hu,sl +2782113 +9.535916 +49.017056 +17.162722 +46.378029 + + +AU +Australia +036 +AUS +AS +OC +Oceania +Canberra +7686850.0 +21515754 +AUD +en-AU +2077456 +112.911057 +-10.062805 +153.639252 +-43.64397 + + +AW +Aruba +533 +ABW +AA +NA +North America +Oranjestad +193.0 +71566 +AWG +nl-AW,es,en +3577279 +-70.0644737196045 +12.623718127152925 +-69.86575120104982 +12.411707706190716 + + +AX +Åland +248 +ALA + +EU +Europe +Mariehamn + +26711 +EUR +sv-AX +661882 +19.317694 +60.488861 +21.011862 +59.90675 + + +AZ +Azerbaijan +031 +AZE +AJ +AS +Asia +Baku +86600.0 +8303512 +AZN +az,ru,hy +587116 +44.774113 +41.90564 +50.370083 +38.38915252685547 + + +BA +Bosnia and Herzegovina +070 +BIH +BK +EU +Europe +Sarajevo +51129.0 +4590000 +BAM +bs,hr-BA,sr-BA +3277605 +15.718945 +45.239193 +19.622223 +42.546112 + + +BB +Barbados +052 +BRB +BB +NA +North America +Bridgetown +431.0 +285653 +BBD +en-BB +3374084 +-59.648922 +13.327257 +-59.420376 +13.039844 + + +BD +Bangladesh +050 +BGD +BG +AS +Asia +Dhaka +144000.0 +156118464 +BDT +bn-BD,en +1210997 +88.028336 +26.631945 +92.673668 +20.743334 + + +BE +Belgium +056 +BEL +BE +EU +Europe +Brussels +30510.0 +10403000 +EUR +nl-BE,fr-BE,de-BE +2802361 +2.546944 +51.505444 +6.403861 +49.49361 + + +BF +Burkina Faso +854 +BFA +UV +AF +Africa +Ouagadougou +274200.0 +16241811 +XOF +fr-BF +2361809 +-5.518916 +15.082593 +2.405395 +9.401108 + + +BG +Bulgaria +100 +BGR +BU +EU +Europe +Sofia +110910.0 +7148785 +BGN +bg,tr-BG +732800 +22.371166 +44.21764 +28.612167 +41.242084 + + +BH +Bahrain +048 +BHR +BA +AS +Asia +Manama +665.0 +738004 +BHD +ar-BH,en,fa,ur +290291 +50.45414 +26.282583 +50.664471 +25.796862 + + +BI +Burundi +108 +BDI +BY +AF +Africa +Bujumbura +27830.0 +9863117 +BIF +fr-BI,rn +433561 +28.993061 +-2.310123 +30.847729 +-4.465713 + + +BJ +Benin +204 +BEN +BN +AF +Africa +Porto-Novo +112620.0 +9056010 +XOF +fr-BJ +2395170 +0.774575 +12.418347 +3.851701 +6.225748 + + +BL +Saint Barthélemy +652 +BLM +TB +NA +North America +Gustavia +21.0 +8450 +EUR +fr +3578476 +-62.8739118253784 +17.928808791949283 +-62.788983372985854 +17.878183227405575 + + +BM +Bermuda +060 +BMU +BD +NA +North America +Hamilton +53.0 +65365 +BMD +en-BM,pt +3573345 +-64.89605 +32.393833 +-64.651993 +32.246639 + + +BN +Brunei +096 +BRN +BX +AS +Asia +Bandar Seri Begawan +5770.0 +395027 +BND +ms-BN,en-BN +1820814 +114.071442 +5.047167 +115.359444 +4.003083 + + +BO +Bolivia +068 +BOL +BL +SA +South America +Sucre +1098580.0 +9947418 +BOB +es-BO,qu,ay +3923057 +-69.640762 +-9.680567 +-57.45809600000001 +-22.896133 + + +BQ +Bonaire +535 +BES + +NA +North America + + +18012 +USD +nl,pap,en +7626844 +-68.416458 +12.304535 +-68.192307 +12.017149 + + +BR +Brazil +076 +BRA +BR +SA +South America +Brasília +8511965.0 +201103330 +BRL +pt-BR,es,en,fr +3469034 +-73.985535 +5.264877 +-32.392998 +-33.750706 + + +BS +Bahamas +044 +BHS +BF +NA +North America +Nassau +13940.0 +301790 +BSD +en-BS +3572887 +-78.995911 +26.919243 +-74.423874 +22.852743 + + +BT +Bhutan +064 +BTN +BT +AS +Asia +Thimphu +47000.0 +699847 +BTN +dz +1252634 +88.75972 +28.323778 +92.125191 +26.70764 + + +BV +Bouvet Island +074 +BVT +BV +AN +Antarctica + + +0 +NOK + +3371123 +3.335499 +-54.400322 +3.487976 +-54.462383 + + +BW +Botswana +072 +BWA +BC +AF +Africa +Gaborone +600370.0 +2029307 +BWP +en-BW,tn-BW +933860 +19.999535 +-17.780813 +29.360781 +-26.907246 + + +BY +Belarus +112 +BLR +BO +EU +Europe +Minsk +207600.0 +9685000 +BYR +be,ru +630336 +23.176889 +56.165806 +32.770805 +51.256416 + + +BZ +Belize +084 +BLZ +BH +NA +North America +Belmopan +22966.0 +314522 +BZD +en-BZ,es +3582678 +-89.224815 +18.496557 +-87.776985 +15.8893 + + +CA +Canada +124 +CAN +CA +NA +North America +Ottawa +9984670.0 +33679000 +CAD +en-CA,fr-CA,iu +6251999 +-141.0 +83.110626 +-52.636291 +41.67598 + + +CC +Cocos [Keeling] Islands +166 +CCK +CK +AS +Asia +West Island +14.0 +628 +AUD +ms-CC,en +1547376 +96.816941408 +-12.072459094 +96.929489344 +-12.208725839 + + +CD +Democratic Republic of the Congo +180 +COD +CG +AF +Africa +Kinshasa +2345410.0 +70916439 +CDF +fr-CD,ln,kg +203312 +12.204144 +5.386098 +31.305912 +-13.455675 + + +CF +Central African Republic +140 +CAF +CT +AF +Africa +Bangui +622984.0 +4844927 +XAF +fr-CF,sg,ln,kg +239880 +14.420097 +11.007569 +27.463421 +2.220514 + + +CG +Republic of the Congo +178 +COG +CF +AF +Africa +Brazzaville +342000.0 +3039126 +XAF +fr-CG,kg,ln-CG +2260494 +11.205009 +3.703082 +18.649839 +-5.027223 + + +CH +Switzerland +756 +CHE +SZ +EU +Europe +Berne +41290.0 +7581000 +CHF +de-CH,fr-CH,it-CH,rm +2658434 +5.957472 +47.805332 +10.491472 +45.825695 + + +CI +Ivory Coast +384 +CIV +IV +AF +Africa +Yamoussoukro +322460.0 +21058798 +XOF +fr-CI +2287781 +-8.599302 +10.736642 +-2.494897 +4.357067 + + +CK +Cook Islands +184 +COK +CW +OC +Oceania +Avarua +240.0 +21388 +NZD +en-CK,mi +1899402 +-161.093658 +-10.023114 +-157.312134 +-21.944164 + + +CL +Chile +152 +CHL +CI +SA +South America +Santiago +756950.0 +16746491 +CLP +es-CL +3895114 +-80.785851 +-17.507553 +-66.417557 +-55.916348 + + +CM +Cameroon +120 +CMR +CM +AF +Africa +Yaoundé +475440.0 +19294149 +XAF +en-CM,fr-CM +2233387 +8.494763 +13.078056 +16.192116 +1.652548 + + +CN +China +156 +CHN +CH +AS +Asia +Beijing +9596960.0 +1330044000 +CNY +zh-CN,yue,wuu,dta,ug,za +1814991 +73.557693 +53.56086 +134.773911 +15.775416 + + +CO +Colombia +170 +COL +CO +SA +South America +Bogotá +1138910.0 +44205293 +COP +es-CO +3686110 +-81.728111 +13.380502 +-66.869835 +-4.225869 + + +CR +Costa Rica +188 +CRI +CS +NA +North America +San José +51100.0 +4516220 +CRC +es-CR,en +3624060 +-85.950623 +11.216819 +-82.555992 +8.032975 + + +CU +Cuba +192 +CUB +CU +NA +North America +Havana +110860.0 +11423000 +CUP +es-CU +3562981 +-84.957428 +23.226042 +-74.131775 +19.828083 + + +CV +Cape Verde +132 +CPV +CV +AF +Africa +Praia +4033.0 +508659 +CVE +pt-CV +3374766 +-25.358747 +17.197178 +-22.669443 +14.808022 + + +CW +Curacao +531 +CUW +UC +NA +North America +Willemstad + +141766 +ANG +nl,pap +7626836 +-69.157204 +12.385672 +-68.733948 +12.032745 + + +CX +Christmas Island +162 +CXR +KT +AS +Asia +The Settlement +135.0 +1500 +AUD +en,zh,ms-CC +2078138 +105.533276992 +-10.412356007 +105.712596992 +-10.5704829995 + + +CY +Cyprus +196 +CYP +CY +EU +Europe +Nicosia +9250.0 +1102677 +EUR +el-CY,tr-CY,en +146669 +32.27308300000004 +35.701527 +34.59791599999994 +34.6332846722908 + + +CZ +Czechia +203 +CZE +EZ +EU +Europe +Prague +78866.0 +10476000 +CZK +cs,sk +3077311 +12.096194 +51.058887 +18.860111 +48.542915 + + +DE +Germany +276 +DEU +GM +EU +Europe +Berlin +357021.0 +81802257 +EUR +de +2921044 +5.865639 +55.055637 +15.039889 +47.275776 + + +DJ +Djibouti +262 +DJI +DJ +AF +Africa +Djibouti +23000.0 +740528 +DJF +fr-DJ,ar,so-DJ,aa +223816 +41.773472 +12.706833 +43.416973 +10.909917 + + +DK +Denmark +208 +DNK +DA +EU +Europe +Copenhagen +43094.0 +5484000 +DKK +da-DK,en,fo,de-DK +2623032 +8.075611 +57.748417 +15.158834 +54.562389 + + +DM +Dominica +212 +DMA +DO +NA +North America +Roseau +754.0 +72813 +XCD +en-DM +3575830 +-61.484108 +15.631809 +-61.244152 +15.20169 + + +DO +Dominican Republic +214 +DOM +DR +NA +North America +Santo Domingo +48730.0 +9823821 +DOP +es-DO +3508796 +-72.003487 +19.929859 +-68.32 +17.543159 + + +DZ +Algeria +012 +DZA +AG +AF +Africa +Algiers +2381740.0 +34586184 +DZD +ar-DZ +2589581 +-8.673868 +37.093723 +11.979548 +18.960028 + + +EC +Ecuador +218 +ECU +EC +SA +South America +Quito +283560.0 +14790608 +USD +es-EC +3658394 +-81.078598 +1.43902 +-75.184586 +-4.998823 + + +EE +Estonia +233 +EST +EN +EU +Europe +Tallinn +45226.0 +1291170 +EUR +et,ru +453733 +21.837584 +59.676224 +28.209972 +57.516193 + + +EG +Egypt +818 +EGY +EG +AF +Africa +Cairo +1001450.0 +80471869 +EGP +ar-EG,en,fr +357994 +24.698111 +31.667334 +35.794861 +21.725389 + + +EH +Western Sahara +732 +ESH +WI +AF +Africa +El Aaiún +266000.0 +273008 +MAD +ar,mey +2461445 +-17.103182 +27.669674 +-8.670276 +20.774158 + + +ER +Eritrea +232 +ERI +ER +AF +Africa +Asmara +121320.0 +5792984 +ERN +aa-ER,ar,tig,kun,ti-ER +338010 +36.438778 +18.003084 +43.13464 +12.359555 + + +ES +Spain +724 +ESP +SP +EU +Europe +Madrid +504782.0 +46505963 +EUR +es-ES,ca,gl,eu,oc +2510769 +-9.290778 +43.791721 +4.315389 +36.000332 + + +ET +Ethiopia +231 +ETH +ET +AF +Africa +Addis Ababa +1127127.0 +88013491 +ETB +am,en-ET,om-ET,ti-ET,so-ET,sid +337996 +32.999939 +14.89375 +47.986179 +3.402422 + + +FI +Finland +246 +FIN +FI +EU +Europe +Helsinki +337030.0 +5244000 +EUR +fi-FI,sv-FI,smn +660013 +20.556944 +70.096054 +31.580944 +59.808777 + + +FJ +Fiji +242 +FJI +FJ +OC +Oceania +Suva +18270.0 +875983 +FJD +en-FJ,fj +2205218 +177.129334 +-12.480111 +-178.424438 +-20.67597 + + +FK +Falkland Islands +238 +FLK +FK +SA +South America +Stanley +12173.0 +2638 +FKP +en-FK +3474414 +-61.345192 +-51.24065 +-57.712486 +-52.360512 + + +FM +Micronesia +583 +FSM +FM +OC +Oceania +Palikir +702.0 +107708 +USD +en-FM,chk,pon,yap,kos,uli,woe,nkr,kpg +2081918 +137.33648 +10.08904 +163.03717 +1.02629 + + +FO +Faroe Islands +234 +FRO +FO +EU +Europe +Tórshavn +1399.0 +48228 +DKK +fo,da-FO +2622320 +-7.458 +62.400749 +-6.399583 +61.394943 + + +FR +France +250 +FRA +FR +EU +Europe +Paris +547030.0 +64768389 +EUR +fr-FR,frp,br,co,ca,eu,oc +3017382 +-5.142222 +51.092804 +9.561556 +41.371582 + + +GA +Gabon +266 +GAB +GB +AF +Africa +Libreville +267667.0 +1545255 +XAF +fr-GA +2400553 +8.695471 +2.322612 +14.502347 +-3.978806 + + +GB +United Kingdom +826 +GBR +UK +EU +Europe +London +244820.0 +62348447 +GBP +en-GB,cy-GB,gd +2635167 +-8.623555 +59.360249 +1.759 +49.906193 + + +GD +Grenada +308 +GRD +GJ +NA +North America +St. George's +344.0 +107818 +XCD +en-GD +3580239 +-61.802344 +12.318283928171299 +-61.57676970108031 +11.986893 + + +GE +Georgia +268 +GEO +GG +AS +Asia +Tbilisi +69700.0 +4630000 +GEL +ka,ru,hy,az +614540 +40.010139 +43.586498 +46.725971 +41.053196 + + +GF +French Guiana +254 +GUF +FG +SA +South America +Cayenne +91000.0 +195506 +EUR +fr-GF +3381670 +-54.542511 +5.776496 +-51.613949 +2.127094 + + +GG +Guernsey +831 +GGY +GK +EU +Europe +St Peter Port +78.0 +65228 +GBP +en,fr +3042362 +-2.682472 +49.738609 +-2.163889 +49.412777 + + +GH +Ghana +288 +GHA +GH +AF +Africa +Accra +239460.0 +24339838 +GHS +en-GH,ak,ee,tw +2300660 +-3.25542 +11.173301 +1.191781 +4.736723 + + +GI +Gibraltar +292 +GIB +GI +EU +Europe +Gibraltar +6.5 +27884 +GIP +en-GI,es,it,pt +2411586 +-5.36626149743654 +36.155439135670726 +-5.338285164001491 +36.10903070140248 + + +GL +Greenland +304 +GRL +GL +NA +North America +Nuuk +2166086.0 +56375 +DKK +kl,da-GL,en +3425505 +-73.04203 +83.627357 +-11.312319 +59.777401 + + +GM +Gambia +270 +GMB +GA +AF +Africa +Banjul +11300.0 +1593256 +GMD +en-GM,mnk,wof,wo,ff +2413451 +-16.825079 +13.826571 +-13.797793 +13.064252 + + +GN +Guinea +324 +GIN +GV +AF +Africa +Conakry +245857.0 +10324025 +GNF +fr-GN +2420477 +-14.926619 +12.67622 +-7.641071 +7.193553 + + +GP +Guadeloupe +312 +GLP +GP +NA +North America +Basse-Terre +1780.0 +443000 +EUR +fr-GP +3579143 +-61.544765 +16.516848 +-61.0 +15.867565 + + +GQ +Equatorial Guinea +226 +GNQ +EK +AF +Africa +Malabo +28051.0 +1014999 +XAF +es-GQ,fr +2309096 +9.346865 +2.346989 +11.335724 +0.92086 + + +GR +Greece +300 +GRC +GR +EU +Europe +Athens +131940.0 +11000000 +EUR +el-GR,en,fr +390903 +19.3736035624134 +41.7484999849641 +28.2470831714347 +34.8020663391466 + + +GS +South Georgia and the South Sandwich Islands +239 +SGS +SX +AN +Antarctica +Grytviken +3903.0 +30 +GBP +en +3474415 +-38.021175 +-53.970467 +-26.229326 +-59.479259 + + +GT +Guatemala +320 +GTM +GT +NA +North America +Guatemala City +108890.0 +13550440 +GTQ +es-GT +3595528 +-92.23629 +17.81522 +-88.223198 +13.737302 + + +GU +Guam +316 +GUM +GQ +OC +Oceania +Hagåtña +549.0 +159358 +USD +en-GU,ch-GU +4043988 +144.619247 +13.652333 +144.953979 +13.240611 + + +GW +Guinea-Bissau +624 +GNB +PU +AF +Africa +Bissau +36120.0 +1565126 +XOF +pt-GW,pov +2372248 +-16.717535 +12.680789 +-13.636522 +10.924265 + + +GY +Guyana +328 +GUY +GY +SA +South America +Georgetown +214970.0 +748486 +GYD +en-GY +3378535 +-61.384762 +8.557567 +-56.480251 +1.17508 + + +HK +Hong Kong +344 +HKG +HK +AS +Asia +Hong Kong +1092.0 +6898686 +HKD +zh-HK,yue,zh,en +1819730 +113.837753 +22.559778 +114.434753 +22.15325 + + +HM +Heard Island and McDonald Islands +334 +HMD +HM +AN +Antarctica + +412.0 +0 +AUD + +1547314 +72.596535 +-52.909416 +73.859146 +-53.192001 + + +HN +Honduras +340 +HND +HO +NA +North America +Tegucigalpa +112090.0 +7989415 +HNL +es-HN +3608932 +-89.350792 +16.510256 +-83.155403 +12.982411 + + +HR +Croatia +191 +HRV +HR +EU +Europe +Zagreb +56542.0 +4491000 +HRK +hr-HR,sr +3202326 +13.493222 +46.53875 +19.427389 +42.43589 + + +HT +Haiti +332 +HTI +HA +NA +North America +Port-au-Prince +27750.0 +9648924 +HTG +ht,fr-HT +3723988 +-74.478584 +20.08782 +-71.613358 +18.021032 + + +HU +Hungary +348 +HUN +HU +EU +Europe +Budapest +93030.0 +9982000 +HUF +hu-HU +719819 +16.111889 +48.585667 +22.906 +45.74361 + + +ID +Indonesia +360 +IDN +ID +AS +Asia +Jakarta +1919440.0 +242968342 +IDR +id,en,nl,jv +1643084 +95.009331 +5.904417 +141.021805 +-10.941861 + + +IE +Ireland +372 +IRL +EI +EU +Europe +Dublin +70280.0 +4622917 +EUR +en-IE,ga-IE +2963597 +-10.478556 +55.387917 +-6.002389 +51.451584 + + +IL +Israel +376 +ISR +IS +AS +Asia + +20770.0 +7353985 +ILS +he,ar-IL,en-IL, +294640 +34.270278754419145 +33.340137 +35.876804 +29.496639 + + +IM +Isle of Man +833 +IMN +IM +EU +Europe +Douglas +572.0 +75049 +GBP +en,gv +3042225 +-4.798722 +54.419724 +-4.3115 +54.055916 + + +IN +India +356 +IND +IN +AS +Asia +New Delhi +3287590.0 +1173108018 +INR +en-IN,hi,bn,te,mr,ta,ur,gu,kn,ml,or,pa,as,bh,sat,ks,ne,sd,kok,doi,mni,sit,sa,fr,lus,inc +1269750 +68.186691 +35.504223 +97.403305 +6.747139 + + +IO +British Indian Ocean Territory +086 +IOT +IO +AS +Asia + +60.0 +4000 +USD +en-IO +1282588 +71.259972 +-5.268333 +72.493164 +-7.438028 + + +IQ +Iraq +368 +IRQ +IZ +AS +Asia +Baghdad +437072.0 +29671605 +IQD +ar-IQ,ku,hy +99237 +38.795887 +37.378029 +48.575916 +29.069445 + + +IR +Iran +364 +IRN +IR +AS +Asia +Tehran +1648000.0 +76923300 +IRR +fa-IR,ku +130758 +44.047279 +39.777222 +63.317471 +25.064083 + + +IS +Iceland +352 +ISL +IC +EU +Europe +Reykjavik +103000.0 +308910 +ISK +is,en,de,da,sv,no +2629691 +-24.546524 +66.53463 +-13.495815 +63.393253 + + +IT +Italy +380 +ITA +IT +EU +Europe +Rome +301230.0 +60340328 +EUR +it-IT,de-IT,fr-IT,sc,ca,co,sl +3175395 +6.614889 +47.095196 +18.513445 +36.652779 + + +JE +Jersey +832 +JEY +JE +EU +Europe +Saint Helier +116.0 +90812 +GBP +en,pt +3042142 +-2.260028 +49.265057 +-2.022083 +49.169834 + + +JM +Jamaica +388 +JAM +JM +NA +North America +Kingston +10991.0 +2847232 +JMD +en-JM +3489940 +-78.366638 +18.526976 +-76.180321 +17.703554 + + +JO +Jordan +400 +JOR +JO +AS +Asia +Amman +92300.0 +6407085 +JOD +ar-JO,en +248816 +34.959999 +33.367668 +39.301167 +29.185888 + + +JP +Japan +392 +JPN +JA +AS +Asia +Tokyo +377835.0 +127288000 +JPY +ja +1861060 +122.93853 +45.52314 +145.820892 +24.249472 + + +KE +Kenya +404 +KEN +KE +AF +Africa +Nairobi +582650.0 +40046566 +KES +en-KE,sw-KE +192950 +33.908859 +5.019938 +41.899078 +-4.678047 + + +KG +Kyrgyzstan +417 +KGZ +KG +AS +Asia +Bishkek +198500.0 +5508626 +KGS +ky,uz,ru +1527747 +69.276611 +43.238224 +80.283165 +39.172832 + + +KH +Cambodia +116 +KHM +CB +AS +Asia +Phnom Penh +181040.0 +14453680 +KHR +km,fr,en +1831722 +102.339996 +14.686417 +107.627724 +10.409083 + + +KI +Kiribati +296 +KIR +KR +OC +Oceania +Tarawa +811.0 +92533 +AUD +en-KI,gil +4030945 +169.556137 +4.71957 +-150.215347 +-11.437038 + + +KM +Comoros +174 +COM +CN +AF +Africa +Moroni +2170.0 +773407 +KMF +ar,fr-KM +921929 +43.21579 +-11.362381 +44.538223 +-12.387857 + + +KN +Saint Kitts and Nevis +659 +KNA +SC +NA +North America +Basseterre +261.0 +49898 +XCD +en-KN +3575174 +-62.86956 +17.420118 +-62.543266 +17.095343 + + +KP +North Korea +408 +PRK +KN +AS +Asia +Pyongyang +120540.0 +22912177 +KPW +ko-KP +1873107 +124.315887 +43.006054 +130.674866 +37.673332 + + +KR +South Korea +410 +KOR +KS +AS +Asia +Seoul +98480.0 +48422644 +KRW +ko-KR,en +1835841 +125.887108 +38.612446 +129.584671 +33.190945 + + +KW +Kuwait +414 +KWT +KU +AS +Asia +Kuwait City +17820.0 +2789132 +KWD +ar-KW,en +285570 +46.555557 +30.095945 +48.431473 +28.524611 + + +KY +Cayman Islands +136 +CYM +CJ +NA +North America +George Town +262.0 +44270 +KYD +en-KY +3580718 +-81.432777 +19.7617 +-79.727272 +19.263029 + + +KZ +Kazakhstan +398 +KAZ +KZ +AS +Asia +Astana +2717300.0 +15340000 +KZT +kk,ru +1522867 +46.491859 +55.451195 +87.312668 +40.936333 + + +LA +Laos +418 +LAO +LA +AS +Asia +Vientiane +236800.0 +6368162 +LAK +lo,fr,en +1655842 +100.093056 +22.500389 +107.697029 +13.910027 + + +LB +Lebanon +422 +LBN +LE +AS +Asia +Beirut +10400.0 +4125247 +LBP +ar-LB,fr-LB,en,hy +272103 +35.114277 +34.691418 +36.639194 +33.05386 + + +LC +Saint Lucia +662 +LCA +ST +NA +North America +Castries +616.0 +160922 +XCD +en-LC +3576468 +-61.07415 +14.103245 +-60.874203 +13.704778 + + +LI +Liechtenstein +438 +LIE +LS +EU +Europe +Vaduz +160.0 +35000 +CHF +de-LI +3042058 +9.477805 +47.273529 +9.632195 +47.055862 + + +LK +Sri Lanka +144 +LKA +CE +AS +Asia +Colombo +65610.0 +21513990 +LKR +si,ta,en +1227603 +79.652916 +9.831361 +81.881279 +5.916833 + + +LR +Liberia +430 +LBR +LI +AF +Africa +Monrovia +111370.0 +3685076 +LRD +en-LR +2275384 +-11.492083 +8.551791 +-7.365113 +4.353057 + + +LS +Lesotho +426 +LSO +LT +AF +Africa +Maseru +30355.0 +1919552 +LSL +en-LS,st,zu,xh +932692 +27.029068 +-28.572058 +29.465761 +-30.668964 + + +LT +Lithuania +440 +LTU +LH +EU +Europe +Vilnius +65200.0 +3565000 +LTL +lt,ru,pl +597427 +20.941528 +56.446918 +26.871944 +53.901306 + + +LU +Luxembourg +442 +LUX +LU +EU +Europe +Luxembourg +2586.0 +497538 +EUR +lb,de-LU,fr-LU +2960313 +5.734556 +50.184944 +6.528472 +49.446583 + + +LV +Latvia +428 +LVA +LG +EU +Europe +Riga +64589.0 +2217969 +LVL +lv,ru,lt +458258 +20.974277 +58.082306 +28.241167 +55.668861 + + +LY +Libya +434 +LBY +LY +AF +Africa +Tripoli +1759540.0 +6461454 +LYD +ar-LY,it,en +2215636 +9.38702 +33.168999 +25.150612 +19.508045 + + +MA +Morocco +504 +MAR +MO +AF +Africa +Rabat +446550.0 +31627428 +MAD +ar-MA,fr +2542007 +-13.168586 +35.9224966985384 +-0.991750000000025 +27.662115 + + +MC +Monaco +492 +MCO +MN +EU +Europe +Monaco +1.95 +32965 +EUR +fr-MC,en,it +2993457 +7.408962249755859 +43.75196717037228 +7.439939260482788 +43.72472839869377 + + +MD +Moldova +498 +MDA +MD +EU +Europe +Chişinău +33843.0 +4324000 +MDL +ro,ru,gag,tr +617790 +26.618944 +48.490166 +30.135445 +45.468887 + + +ME +Montenegro +499 +MNE +MJ +EU +Europe +Podgorica +14026.0 +666730 +EUR +sr,hu,bs,sq,hr,rom +3194884 +18.461306 +43.570137 +20.358833 +41.850166 + + +MF +Saint Martin +663 +MAF +RN +NA +North America +Marigot +53.0 +35925 +EUR +fr +3578421 +-63.152767 +18.130354 +-63.012993 +18.052231 + + +MG +Madagascar +450 +MDG +MA +AF +Africa +Antananarivo +587040.0 +21281844 +MGA +fr-MG,mg +1062947 +43.224876 +-11.945433 +50.48378 +-25.608952 + + +MH +Marshall Islands +584 +MHL +RM +OC +Oceania +Majuro +181.3 +65859 +USD +mh,en-MH +2080185 +165.524918 +14.62 +171.931808 +5.587639 + + +MK +Macedonia +807 +MKD +MK +EU +Europe +Skopje +25333.0 +2062294 +MKD +mk,sq,tr,rmm,sr +718075 +20.464695 +42.361805 +23.038139 +40.860195 + + +ML +Mali +466 +MLI +ML +AF +Africa +Bamako +1240000.0 +13796354 +XOF +fr-ML,bm +2453866 +-12.242614 +25.000002 +4.244968 +10.159513 + + +MM +Myanmar [Burma] +104 +MMR +BM +AS +Asia +Nay Pyi Taw +678500.0 +53414374 +MMK +my +1327865 +92.189278 +28.543249 +101.176781 +9.784583 + + +MN +Mongolia +496 +MNG +MG +AS +Asia +Ulan Bator +1565000.0 +3086918 +MNT +mn,ru +2029969 +87.749664 +52.154251 +119.924309 +41.567638 + + +MO +Macao +446 +MAC +MC +AS +Asia +Macao +254.0 +449198 +MOP +zh,zh-MO,pt +1821275 +113.528946 +22.222334 +113.565834 +22.180389 + + +MP +Northern Mariana Islands +580 +MNP +CQ +OC +Oceania +Saipan +477.0 +53883 +USD +fil,tl,zh,ch-MP,en-MP +4041468 +144.88626 +20.55344 +146.06528 +14.11023 + + +MQ +Martinique +474 +MTQ +MB +NA +North America +Fort-de-France +1100.0 +432900 +EUR +fr-MQ +3570311 +-61.230118 +14.878819 +-60.81551 +14.392262 + + +MR +Mauritania +478 +MRT +MR +AF +Africa +Nouakchott +1030700.0 +3205060 +MRO +ar-MR,fuc,snk,fr,mey,wo +2378080 +-17.066521 +27.298073 +-4.827674 +14.715547 + + +MS +Montserrat +500 +MSR +MH +NA +North America +Plymouth +102.0 +9341 +XCD +en-MS +3578097 +-62.24138237036129 +16.824060205313184 +-62.144100129608205 +16.674768935441556 + + +MT +Malta +470 +MLT +MT +EU +Europe +Valletta +316.0 +403000 +EUR +mt,en-MT +2562770 +14.184376415657312 +36.079112527087844 +14.577639 +35.810276 + + +MU +Mauritius +480 +MUS +MP +AF +Africa +Port Louis +2040.0 +1294104 +MUR +en-MU,bho,fr +934292 +56.512718 +-10.319255 +63.500179 +-20.525717 + + +MV +Maldives +462 +MDV +MV +AS +Asia +Malé +300.0 +395650 +MVR +dv,en +1282028 +72.693222 +7.098361 +73.637276 +-0.692694 + + +MW +Malawi +454 +MWI +MI +AF +Africa +Lilongwe +118480.0 +15447500 +MWK +ny,yao,tum,swk +927384 +32.67395 +-9.367541 +35.916821 +-17.125 + + +MX +Mexico +484 +MEX +MX +NA +North America +Mexico City +1972550.0 +112468855 +MXN +es-MX +3996063 +-118.453949 +32.716759 +-86.703392 +14.532866 + + +MY +Malaysia +458 +MYS +MY +AS +Asia +Kuala Lumpur +329750.0 +28274729 +MYR +ms-MY,en,zh,ta,te,ml,pa,th +1733045 +99.643448 +7.363417 +119.267502 +0.855222 + + +MZ +Mozambique +508 +MOZ +MZ +AF +Africa +Maputo +801590.0 +22061451 +MZN +pt-MZ,vmw +1036973 +30.217319 +-10.471883 +40.842995 +-26.868685 + + +NA +Namibia +516 +NAM +WA +AF +Africa +Windhoek +825418.0 +2128471 +NAD +en-NA,af,de,hz,naq +3355338 +11.71563 +-16.959894 +25.256701 +-28.97143 + + +NC +New Caledonia +540 +NCL +NC +OC +Oceania +Noumea +19060.0 +216494 +XPF +fr-NC +2139685 +163.564667 +-19.549778 +168.129135 +-22.698 + + +NE +Niger +562 +NER +NG +AF +Africa +Niamey +1267000.0 +15878271 +XOF +fr-NE,ha,kr,dje +2440476 +0.16625 +23.525026 +15.995643 +11.696975 + + +NF +Norfolk Island +574 +NFK +NF +OC +Oceania +Kingston +34.6 +1828 +AUD +en-NF +2155115 +167.91543230151365 +-28.995170686948427 +167.99773740209957 +-29.063076742954735 + + +NG +Nigeria +566 +NGA +NI +AF +Africa +Abuja +923768.0 +154000000 +NGN +en-NG,ha,yo,ig,ff +2328926 +2.668432 +13.892007 +14.680073 +4.277144 + + +NI +Nicaragua +558 +NIC +NU +NA +North America +Managua +129494.0 +5995928 +NIO +es-NI,en +3617476 +-87.690308 +15.025909 +-82.738289 +10.707543 + + +NL +Netherlands +528 +NLD +NL +EU +Europe +Amsterdam +41526.0 +16645000 +EUR +nl-NL,fy-NL +2750405 +3.362556 +53.512196 +7.227944 +50.753918 + + +NO +Norway +578 +NOR +NO +EU +Europe +Oslo +324220.0 +5009150 +NOK +no,nb,nn,se,fi +3144096 +4.650167 +71.18811 +31.078052520751953 +57.977917 + + +NP +Nepal +524 +NPL +NP +AS +Asia +Kathmandu +140800.0 +28951852 +NPR +ne,en +1282988 +80.056274 +30.43339 +88.199333 +26.356722 + + +NR +Nauru +520 +NRU +NR +OC +Oceania + +21.0 +10065 +AUD +na,en-NR +2110425 +166.899033 +-0.504306 +166.945282 +-0.552333 + + +NU +Niue +570 +NIU +NE +OC +Oceania +Alofi +260.0 +2166 +NZD +niu,en-NU +4036232 +-169.951004 +-18.951069 +-169.775177 +-19.152193 + + +NZ +New Zealand +554 +NZL +NZ +OC +Oceania +Wellington +268680.0 +4252277 +NZD +en-NZ,mi +2186224 +166.7155 +-34.389668 +-180.0 +-47.286026 + + +OM +Oman +512 +OMN +MU +AS +Asia +Muscat +212460.0 +2967717 +OMR +ar-OM,en,bal,ur +286963 +51.882 +26.387972 +59.836582 +16.64575 + + +PA +Panama +591 +PAN +PM +NA +North America +Panama City +78200.0 +3410676 +PAB +es-PA,en +3703430 +-83.051445 +9.637514 +-77.17411 +7.197906 + + +PE +Peru +604 +PER +PE +SA +South America +Lima +1285220.0 +29907003 +PEN +es-PE,qu,ay +3932488 +-81.326744 +-0.012977 +-68.677986 +-18.349728 + + +PF +French Polynesia +258 +PYF +FP +OC +Oceania +Papeete +4167.0 +270485 +XPF +fr-PF,ty +4030656 +-152.877167 +-7.903573 +-134.929825 +-27.653572 + + +PG +Papua New Guinea +598 +PNG +PP +OC +Oceania +Port Moresby +462840.0 +6064515 +PGK +en-PG,ho,meu,tpi +2088628 +140.842865 +-1.318639 +155.96344 +-11.657861 + + +PH +Philippines +608 +PHL +RP +AS +Asia +Manila +300000.0 +99900177 +PHP +tl,en-PH,fil +1694008 +116.931557 +21.120611 +126.601524 +4.643306 + + +PK +Pakistan +586 +PAK +PK +AS +Asia +Islamabad +803940.0 +184404791 +PKR +ur-PK,en-PK,pa,sd,ps,brh +1168579 +60.878613 +37.097 +77.840919 +23.786722 + + +PL +Poland +616 +POL +PL +EU +Europe +Warsaw +312685.0 +38500000 +PLN +pl +798544 +14.123 +54.839138 +24.150749 +49.006363 + + +PM +Saint Pierre and Miquelon +666 +SPM +SB +NA +North America +Saint-Pierre +242.0 +7012 +EUR +fr-PM +3424932 +-56.420658 +47.146286 +-56.252991 +46.786041 + + +PN +Pitcairn Islands +612 +PCN +PC +OC +Oceania +Adamstown +47.0 +46 +NZD +en-PN +4030699 +-128.346436 +-24.315865 +-124.77285 +-24.672565 + + +PR +Puerto Rico +630 +PRI +RQ +NA +North America +San Juan +9104.0 +3916632 +USD +en-PR,es-PR +4566966 +-67.942726 +18.520166 +-65.242737 +17.926405 + + +PS +Palestine +275 +PSE +WE +AS +Asia + +5970.0 +3800000 +ILS +ar-PS +6254930 +34.21665954589844 +32.54638671875 +35.5732955932617 +31.216541290283203 + + +PT +Portugal +620 +PRT +PO +EU +Europe +Lisbon +92391.0 +10676000 +EUR +pt-PT,mwl +2264397 +-9.495944 +42.145638 +-6.182694 +36.96125 + + +PW +Palau +585 +PLW +PS +OC +Oceania +Melekeok - Palau State Capital +458.0 +19907 +USD +pau,sov,en-PW,tox,ja,fil,zh +1559582 +131.11788 +8.46966 +134.72307 +2.8036 + + +PY +Paraguay +600 +PRY +PA +SA +South America +Asunción +406750.0 +6375830 +PYG +es-PY,gn +3437598 +-62.647076 +-19.294041 +-54.259354 +-27.608738 + + +QA +Qatar +634 +QAT +QA +AS +Asia +Doha +11437.0 +840926 +QAR +ar-QA,es +289688 +50.757221 +26.154722 +51.636639 +24.482944 + + +RE +Réunion +638 +REU +RE +AF +Africa +Saint-Denis +2517.0 +776948 +EUR +fr-RE +935317 +55.219086 +-20.856855 +55.845039 +-21.372211 + + +RO +Romania +642 +ROU +RO +EU +Europe +Bucharest +237500.0 +21959278 +RON +ro,hu,rom +798549 +20.269972 +48.266945 +29.691055 +43.627304 + + +RS +Serbia +688 +SRB +RI +EU +Europe +Belgrade +88361.0 +7344847 +RSD +sr,hu,bs,rom +6290252 +18.817020416259766 +46.18138885498047 +23.00499725341797 +42.232215881347656 + + +RU +Russia +643 +RUS +RS +EU +Europe +Moscow +1.71E7 +140702000 +RUB +ru,tt,xal,cau,ady,kv,ce,tyv,cv,udm,tut,mns,bua,myv,mdf,chm,ba,inh,tut,kbd,krc,ava,sah,nog +2017370 +19.25 +81.857361 +-169.05 +41.188862 + + +RW +Rwanda +646 +RWA +RW +AF +Africa +Kigali +26338.0 +11055976 +RWF +rw,en-RW,fr-RW,sw +49518 +28.856794 +-1.053481 +30.895958 +-2.840679 + + +SA +Saudi Arabia +682 +SAU +SA +AS +Asia +Riyadh +1960582.0 +25731776 +SAR +ar-SA +102358 +34.495693 +32.158333 +55.666584 +15.61425 + + +SB +Solomon Islands +090 +SLB +BP +OC +Oceania +Honiara +28450.0 +559198 +SBD +en-SB,tpi +2103350 +155.508606 +-6.589611 +166.980865 +-11.850555 + + +SC +Seychelles +690 +SYC +SE +AF +Africa +Victoria +455.0 +88340 +SCR +en-SC,fr-SC +241170 +46.204769 +-4.283717 +56.279507 +-9.753867 + + +SD +Sudan +729 +SDN +SU +AF +Africa +Khartoum +1861484.0 +35000000 +SDG +ar-SD,en,fia +366755 +21.827774047851562 +22.232219696044922 +38.60749816894531 +8.684720993041992 + + +SE +Sweden +752 +SWE +SW +EU +Europe +Stockholm +449964.0 +9555893 +SEK +sv-SE,se,sma,fi-SE +2661886 +11.118694 +69.0625 +24.156292483918484 +55.337112 + + +SG +Singapore +702 +SGP +SN +AS +Asia +Singapore +692.7 +4701069 +SGD +cmn,en-SG,ms-SG,ta-SG,zh-SG +1880251 +103.638275 +1.471278 +104.007469 +1.258556 + + +SH +Saint Helena +654 +SHN +SH +AF +Africa +Jamestown +410.0 +7460 +SHP +en-SH +3370751 +-14.42123 +-7.887815 +-5.638753 +-16.019543 + + +SI +Slovenia +705 +SVN +SI +EU +Europe +Ljubljana +20273.0 +2007000 +EUR +sl,sh +3190538 +13.383083 +46.877918 +16.566 +45.413139 + + +SJ +Svalbard and Jan Mayen +744 +SJM +SV +EU +Europe +Longyearbyen +62049.0 +2550 +NOK +no,ru +607072 +17.699389 +80.762085 +33.287334 +79.220306 + + +SK +Slovakia +703 +SVK +LO +EU +Europe +Bratislava +48845.0 +5455000 +EUR +sk,hu +3057568 +16.84775 +49.603168 +22.570444 +47.728111 + + +SL +Sierra Leone +694 +SLE +SL +AF +Africa +Freetown +71740.0 +5245695 +SLL +en-SL,men,tem +2403846 +-13.307631 +10.0 +-10.284238 +6.929611 + + +SM +San Marino +674 +SMR +SM +EU +Europe +San Marino +61.2 +31477 +EUR +it-SM +3168068 +12.403538978820734 +43.99223730851663 +12.51653186779788 +43.8937092171425 + + +SN +Senegal +686 +SEN +SG +AF +Africa +Dakar +196190.0 +12323252 +XOF +fr-SN,wo,fuc,mnk +2245662 +-17.535236 +16.691633 +-11.355887 +12.307275 + + +SO +Somalia +706 +SOM +SO +AF +Africa +Mogadishu +637657.0 +10112453 +SOS +so-SO,ar-SO,it,en-SO +51537 +40.986595 +11.979166 +51.412636 +-1.674868 + + +SR +Suriname +740 +SUR +NS +SA +South America +Paramaribo +163270.0 +492829 +SRD +nl-SR,en,srn,hns,jv +3382998 +-58.086563 +6.004546 +-53.977493 +1.831145 + + +SS +South Sudan +728 +SSD +OD +AF +Africa +Juba +644329.0 +8260490 +SSP +en +7909807 +24.140274047851562 +12.219148635864258 +35.9405517578125 +3.493394374847412 + + +ST +São Tomé and Príncipe +678 +STP +TP +AF +Africa +São Tomé +1001.0 +175808 +STD +pt-ST +2410758 +6.47017 +1.701323 +7.466374 +0.024766 + + +SV +El Salvador +222 +SLV +ES +NA +North America +San Salvador +21040.0 +6052064 +USD +es-SV +3585968 +-90.128662 +14.445067 +-87.692162 +13.148679 + + +SX +Sint Maarten +534 +SXM +NN +NA +North America +Philipsburg + +37429 +ANG +nl,en +7609695 +-63.144039 +18.070248 +-63.012993 +18.011692 + + +SY +Syria +760 +SYR +SY +AS +Asia +Damascus +185180.0 +22198110 +SYP +ar-SY,ku,hy,arc,fr,en +163843 +35.727222 +37.319138 +42.385029 +32.310665 + + +SZ +Swaziland +748 +SWZ +WZ +AF +Africa +Mbabane +17363.0 +1354051 +SZL +en-SZ,ss-SZ +934841 +30.794107 +-25.719648 +32.13726 +-27.317101 + + +TC +Turks and Caicos Islands +796 +TCA +TK +NA +North America +Cockburn Town +430.0 +20556 +USD +en-TC +3576916 +-72.483871 +21.961878 +-71.123642 +21.422626 + + +TD +Chad +148 +TCD +CD +AF +Africa +N'Djamena +1284000.0 +10543464 +XAF +fr-TD,ar-TD,sre +2434508 +13.473475 +23.450369 +24.002661 +7.441068 + + +TF +French Southern Territories +260 +ATF +FS +AN +Antarctica +Port-aux-Français +7829.0 +140 +EUR +fr +1546748 +50.170258 +-37.790722 +77.598808 +-49.735184 + + +TG +Togo +768 +TGO +TO +AF +Africa +Lomé +56785.0 +6587239 +XOF +fr-TG,ee,hna,kbp,dag,ha +2363686 +-0.147324 +11.138977 +1.806693 +6.104417 + + +TH +Thailand +764 +THA +TH +AS +Asia +Bangkok +514000.0 +67089500 +THB +th,en +1605651 +97.345642 +20.463194 +105.639389 +5.61 + + +TJ +Tajikistan +762 +TJK +TI +AS +Asia +Dushanbe +143100.0 +7487489 +TJS +tg,ru +1220409 +67.387138 +41.042252 +75.137222 +36.674137 + + +TK +Tokelau +772 +TKL +TL +OC +Oceania + +10.0 +1466 +NZD +tkl,en-TK +4031074 +-172.50033569335938 +-8.553613662719727 +-171.21142578125 +-9.381111145019531 + + +TL +East Timor +626 +TLS +TT +OC +Oceania +Dili +15007.0 +1154625 +USD +tet,pt-TL,id,en +1966436 +124.04609680175781 +-8.135833740234375 +127.30859375 +-9.463626861572266 + + +TM +Turkmenistan +795 +TKM +TX +AS +Asia +Ashgabat +488100.0 +4940916 +TMT +tk,ru,uz +1218197 +52.441444 +42.795555 +66.684303 +35.141083 + + +TN +Tunisia +788 +TUN +TS +AF +Africa +Tunis +163610.0 +10589025 +TND +ar-TN,fr +2464461 +7.524833 +37.543915 +11.598278 +30.240417 + + +TO +Tonga +776 +TON +TN +OC +Oceania +Nuku'alofa +748.0 +122580 +TOP +to,en-TO +4032283 +-175.682266 +-15.562988 +-173.907578 +-21.455057 + + +TR +Turkey +792 +TUR +TU +AS +Asia +Ankara +780580.0 +77804122 +TRY +tr-TR,ku,diq,az,av +298795 +25.668501 +42.107613 +44.834999 +35.815418 + + +TT +Trinidad and Tobago +780 +TTO +TD +NA +North America +Port of Spain +5128.0 +1228691 +TTD +en-TT,hns,fr,es,zh +3573591 +-61.923771 +11.338342 +-60.517933 +10.036105 + + +TV +Tuvalu +798 +TUV +TV +OC +Oceania +Funafuti +26.0 +10472 +AUD +tvl,en,sm,gil +2110297 +176.064865 +-5.641972 +179.863281 +-10.801169 + + +TW +Taiwan +158 +TWN +TW +AS +Asia +Taipei +35980.0 +22894384 +TWD +zh-TW,zh,nan,hak +1668284 +119.534691 +25.29825 +122.000443 +21.901806 + + +TZ +Tanzania +834 +TZA +TZ +AF +Africa +Dodoma +945087.0 +41892895 +TZS +sw-TZ,en,ar +149590 +29.327168 +-0.990736 +40.443222 +-11.745696 + + +UA +Ukraine +804 +UKR +UP +EU +Europe +Kyiv +603700.0 +45415596 +UAH +uk,ru-UA,rom,pl,hu +690791 +22.128889 +52.369362 +40.20739 +44.390415 + + +UG +Uganda +800 +UGA +UG +AF +Africa +Kampala +236040.0 +33398682 +UGX +en-UG,lg,sw,ar +226074 +29.573252 +4.214427 +35.036049 +-1.48405 + + +UM +U.S. Minor Outlying Islands +581 +UMI + +OC +Oceania + +0.0 +0 +USD +en-UM +5854968 +-177.392029 +28.219814 +166.654526 +-0.389006 + + +US +United States +840 +USA +US +NA +North America +Washington +9629091.0 +310232863 +USD +en-US,es-US,haw,fr +6252001 +-124.733253 +49.388611 +-66.954811 +24.544245 + + +UY +Uruguay +858 +URY +UY +SA +South America +Montevideo +176220.0 +3477000 +UYU +es-UY +3439705 +-58.442722 +-30.082224 +-53.073933 +-34.980816 + + +UZ +Uzbekistan +860 +UZB +UZ +AS +Asia +Tashkent +447400.0 +27865738 +UZS +uz,ru,tg +1512440 +55.996639 +45.575001 +73.132278 +37.184444 + + +VA +Vatican City +336 +VAT +VT +EU +Europe +Vatican +0.44 +921 +EUR +la,it,fr +3164670 +12.44570678169205 +41.90743830885576 +12.45837546629481 +41.90027960306854 + + +VC +Saint Vincent and the Grenadines +670 +VCT +VC +NA +North America +Kingstown +389.0 +104217 +XCD +en-VC,fr +3577815 +-61.46090317727658 +13.377834 +-61.11388 +12.583984810969037 + + +VE +Venezuela +862 +VEN +VE +SA +South America +Caracas +912050.0 +27223228 +VEF +es-VE +3625428 +-73.354073 +12.201903 +-59.80378 +0.626311 + + +VG +British Virgin Islands +092 +VGB +VI +NA +North America +Road Town +153.0 +21730 +USD +en-VG +3577718 +-64.715363 +18.757221 +-64.268768 +18.38998 + + +VI +U.S. Virgin Islands +850 +VIR +VQ +NA +North America +Charlotte Amalie +352.0 +108708 +USD +en-VI +4796775 +-65.038231 +18.391747 +-64.565178 +17.681725 + + +VN +Vietnam +704 +VNM +VM +AS +Asia +Hanoi +329560.0 +89571130 +VND +vi,en,fr,zh,km +1562822 +102.148224 +23.388834 +109.464638 +8.559611 + + +VU +Vanuatu +548 +VUT +NH +OC +Oceania +Port Vila +12200.0 +221552 +VUV +bi,en-VU,fr-VU +2134431 +166.524979 +-13.073444 +169.904785 +-20.248945 + + +WF +Wallis and Futuna +876 +WLF +WF +OC +Oceania +Mata-Utu +274.0 +16025 +XPF +wls,fud,fr-WF +4034749 +-178.1848112896414 +-13.216758181061444 +-176.16174317718253 +-14.314559989820843 + + +WS +Samoa +882 +WSM +WS +OC +Oceania +Apia +2944.0 +192001 +WST +sm,en-WS +4034894 +-172.798599 +-13.432207 +-171.415741 +-14.040939 + + +XK +Kosovo +0 +XKX +KV +EU +Europe +Pristina + +1800000 +EUR +sq,sr +831053 +19.977481504492914 +43.2682495807952 +21.80335088694943 +41.856369601859925 + + +YE +Yemen +887 +YEM +YM +AS +Asia +Sanaa +527970.0 +23495361 +YER +ar-YE +69543 +42.5325394314234 +18.9999989031009 +54.5305388163283 +12.1110910264462 + + +YT +Mayotte +175 +MYT +MF +AF +Africa +Mamoutzou +374.0 +159042 +EUR +fr-YT +1024031 +45.03796 +-12.648891 +45.29295 +-13.000132 + + +ZA +South Africa +710 +ZAF +SF +AF +Africa +Pretoria +1219912.0 +49000000 +ZAR +zu,xh,af,nso,en-ZA,tn,st,ts,ss,ve,nr +953987 +16.458021 +-22.126612 +32.895973 +-34.839828 + + +ZM +Zambia +894 +ZMB +ZA +AF +Africa +Lusaka +752614.0 +13460305 +ZMK +en-ZM,bem,loz,lun,lue,ny,toi +895949 +21.999371 +-8.22436 +33.705704 +-18.079473 + + +ZW +Zimbabwe +716 +ZWE +ZI +AF +Africa +Harare +390580.0 +11651858 +ZWL +en-ZW,sn,nr,nd +878675 +25.237028 +-15.608835 +33.056305 +-22.417738 + + diff --git a/db/migrate/20140117185510_drop_countries.rb b/db/migrate/20140117185510_drop_countries.rb new file mode 100644 index 000000000..fe9144cbb --- /dev/null +++ b/db/migrate/20140117185510_drop_countries.rb @@ -0,0 +1,5 @@ +class DropCountries < ActiveRecord::Migration + def change + drop_table :countries + end +end diff --git a/db/structure.sql b/db/structure.sql index 031b89aa5..5c4fdf8c7 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -274,39 +274,6 @@ CREATE SEQUENCE client_applications_id_seq ALTER SEQUENCE client_applications_id_seq OWNED BY client_applications.id; --- --- Name: countries; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE countries ( - id integer NOT NULL, - code character varying(2) NOT NULL, - min_lat double precision NOT NULL, - max_lat double precision NOT NULL, - min_lon double precision NOT NULL, - max_lon double precision NOT NULL -); - - --- --- Name: countries_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE countries_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: countries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE countries_id_seq OWNED BY countries.id; - - -- -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -1187,13 +1154,6 @@ ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_s ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass); --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY countries ALTER COLUMN id SET DEFAULT nextval('countries_id_seq'::regclass); - - -- -- Name: id; Type: DEFAULT; Schema: public; Owner: - -- @@ -1344,14 +1304,6 @@ ALTER TABLE ONLY client_applications ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id); --- --- Name: countries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY countries - ADD CONSTRAINT countries_pkey PRIMARY KEY (id); - - -- -- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -1665,13 +1617,6 @@ CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_i CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id); --- --- Name: countries_code_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE UNIQUE INDEX countries_code_idx ON countries USING btree (code); - - -- -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: -- @@ -2476,6 +2421,8 @@ INSERT INTO schema_migrations (version) VALUES ('20131212124700'); INSERT INTO schema_migrations (version) VALUES ('20140115192822'); +INSERT INTO schema_migrations (version) VALUES ('20140117185510'); + INSERT INTO schema_migrations (version) VALUES ('21'); INSERT INTO schema_migrations (version) VALUES ('22'); diff --git a/lib/country.rb b/lib/country.rb new file mode 100644 index 000000000..ea52efd77 --- /dev/null +++ b/lib/country.rb @@ -0,0 +1,38 @@ +class Country + attr_reader :code, :min_lat, :max_lat, :min_lon, :max_lon + + def initialize(code, min_lat, max_lat, min_lon, max_lon) + @code = code + @min_lat = min_lat + @max_lat = max_lat + @min_lon = min_lon + @max_lon = max_lon + end + + def self.find_by_code(code) + countries[code] + end + +private + + def self.countries + @@countries ||= load_countries + end + + def self.load_countries + countries = Hash.new + xml = REXML::Document.new(File.read("config/countries.xml")) + + xml.elements.each("geonames/country") do |ele| + code = ele.get_text("countryCode").to_s + minlon = ele.get_text("west").to_s + minlat = ele.get_text("south").to_s + maxlon = ele.get_text("east").to_s + maxlat = ele.get_text("north").to_s + + countries[code] = Country.new(code, minlat.to_f, maxlat.to_f, minlon.to_f, maxlon.to_f) + end + + countries + end +end diff --git a/test/unit/country_test.rb b/test/unit/country_test.rb deleted file mode 100644 index 84bb2c4a1..000000000 --- a/test/unit/country_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class CountryTest < ActiveSupport::TestCase - fixtures :countries - - test "country count" do - assert_equal 2, Country.count - end -end