root/trunk/projects/bos/web/countries.lisp

Revision 3676, 15.3 kB (checked in by hans, 4 months ago)

Move LABELS into value position in order to preserve top-levelness
of DEFVAR.

Line 
1 ;;; -*- mode: lisp; coding: utf-8 -*-
2
3 ;;; Define coordinates of countries by ISO 3166 code
4
5 (in-package :bos.web)
6
7 (defvar *country-coords*
8   (labels ((degrees2float (string)
9              (ppcre:register-groups-bind (degrees minutes orientation)
10                  ("(\\d+) +(\\d+) +([WESN])" string)
11                (assert (and degrees minutes orientation))
12                (* (case (char orientation 0) ((#\W #\S) -1d0) (otherwise 1d0))
13                   (+ (float (parse-integer degrees) 0d0)
14                      (/ (float (parse-integer minutes) 0d0) 60d0)))))
15            (parse-coord (args)
16              (destructuring-bind (country lon lat)
17                  args
18                (list country (degrees2float lon) (degrees2float lat)))))
19     (mapcar #'parse-coord
20             '((:AW "12 30 N" "69 58 W") (:AG "17 03 N" "61 48 W") (:AE "24 00 N" "54 00 E")
21               (:AF "33 00 N" "65 00 E") (:DZ "28 00 N" "3 00 E") (:AZ "40 30 N" "47 30 E")
22               (:AL "41 00 N" "20 00 E") (:AM "40 00 N" "45 00 E") (:AD "42 30 N" "1 30 E")
23               (:AO "12 30 S" "18 30 E") (:AS "14 20 S" "170 00 W") (:AR "34 00 S" "64 00 W")
24               (:AU "27 00 S" "133 00 E") (:AT "47 20 N" "13 20 E") (:AI "18 15 N" "63 10 W")
25               (:AQ "90 00 S" "0 00 E") (:BH "26 00 N" "50 33 E") (:BB "13 10 N" "59 32 W")
26               (:BW "22 00 S" "24 00 E") (:BM "32 20 N" "64 45 W") (:BE "50 50 N" "4 00 E")
27               (:BS "24 15 N" "76 00 W") (:BD "24 00 N" "90 00 E") (:BZ "17 15 N" "88 45 W")
28               (:BA "44 00 N" "18 00 E") (:BO "17 00 S" "65 00 W") (:MM "22 00 N" "98 00 E")
29               (:BJ "9 30 N" "2 15 E") (:BY "53 00 N" "28 00 E") (:SB "8 00 S" "159 00 E")
30               (:BR "10 00 S" "55 00 W") (:BT "27 30 N" "90 30 E") (:BG "43 00 N" "25 00 E")
31               (:BV "54 26 S" "3 24 E") (:BN "4 30 N" "114 40 E") (:BI "3 30 S" "30 00 E")
32               (:CA "60 00 N" "95 00 W") (:KH "13 00 N" "105 00 E") (:TD "15 00 N" "19 00 E")
33               (:LK "7 00 N" "81 00 E") (:CG "1 00 S" "15 00 E") (:CD "0 00 N" "25 00 E")
34               (:CN "35 00 N" "105 00 E") (:CL "30 00 S" "71 00 W") (:KY "19 30 N" "80 30 W")
35               (:CC "12 30 S" "96 50 E") (:CM "6 00 N" "12 00 E") (:KM "12 10 S" "44 15 E")
36               (:CO "4 00 N" "72 00 W") (:MP "15 12 N" "145 45 E") (:CR "10 00 N" "84 00 W")
37               (:CF "7 00 N" "21 00 E") (:CU "21 30 N" "80 00 W") (:CV "16 00 N" "24 00 W")
38               (:CK "21 14 S" "159 46 W") (:CY "35 00 N" "33 00 E") (:DK "56 00 N" "10 00 E")
39               (:DJ "11 30 N" "43 00 E") (:DM "15 25 N" "61 20 W") (:DO "19 00 N" "70 40 W")
40               (:EC "2 00 S" "77 30 W") (:EG "27 00 N" "30 00 E") (:IE "53 00 N" "8 00 W")
41               (:GQ "2 00 N" "10 00 E") (:EE "59 00 N" "26 00 E") (:ER "15 00 N" "39 00 E")
42               (:SV "13 50 N" "88 55 W") (:ET "8 00 N" "38 00 E") (:CZ "49 45 N" "15 30 E")
43               (:FI "64 00 N" "26 00 E") (:FJ "18 00 S" "175 00 E") (:FK "51 45 S" "59 00 W")
44               (:FM "6 55 N" "158 15 E") (:FO "62 00 N" "7 00 W") (:PF "15 00 S" "140 00 W")
45               (:FR "46 00 N" "2 00 E") (:GM "13 28 N" "16 34 W") (:GA "1 00 S" "11 45 E")
46               (:GE "42 00 N" "43 30 E") (:GH "8 00 N" "2 00 W") (:GI "36 08 N" "5 21 W")
47               (:GD "12 07 N" "61 40 W") (:GG "49 28 N" "2 35 W") (:GL "72 00 N" "40 00 W")
48               (:DE "51 00 N" "9 00 E") (:GU "13 28 N" "144 47 E") (:GR "39 00 N" "22 00 E")
49               (:GT "15 30 N" "90 15 W") (:GN "11 00 N" "10 00 W") (:GY "5 00 N" "59 00 W")
50               (:PS "31 25 N" "34 20 E") (:HT "19 00 N" "72 25 W") (:HK "22 15 N" "114 10 E")
51               (:HM "53 06 S" "72 31 E") (:HN "15 00 N" "86 30 W") (:HR "45 10 N" "15 30 E")
52               (:HU "47 00 N" "20 00 E") (:IS "65 00 N" "18 00 W") (:ID "5 00 S" "120 00 E")
53               (:IM "54 15 N" "4 30 W") (:IN "20 00 N" "77 00 E") (:IO "6 00 S" "71 30 E")
54               (:IR "32 00 N" "53 00 E") (:IL "31 30 N" "34 45 E") (:IT "42 50 N" "12 50 E")
55               (:CI "8 00 N" "5 00 W") (:IQ "33 00 N" "44 00 E") (:JP "36 00 N" "138 00 E")
56               (:JE "49 15 N" "2 10 W") (:JM "18 15 N" "77 30 W") (:JO "31 00 N" "36 00 E")
57               (:KE "1 00 N" "38 00 E") (:KG "41 00 N" "75 00 E") (:KP "40 00 N" "127 00 E")
58               (:KI "1 25 N" "173 00 E") (:KR "37 00 N" "127 30 E")
59               (:CX "10 30 S" "105 40 E") (:KW "29 30 N" "45 45 E") (:KZ "48 00 N" "68 00 E")
60               (:LA "18 00 N" "105 00 E") (:LB "33 50 N" "35 50 E") (:LV "57 00 N" "25 00 E")
61               (:LT "56 00 N" "24 00 E") (:LR "6 30 N" "9 30 W") (:SK "48 40 N" "19 30 E")
62               (:LI "47 16 N" "9 32 E") (:LS "29 30 S" "28 30 E") (:LU "49 45 N" "6 10 E")
63               (:LY "25 00 N" "17 00 E") (:MG "20 00 S" "47 00 E") (:MO "22 10 N" "113 33 E")
64               (:MD "47 00 N" "29 00 E") (:YT "12 50 S" "45 10 E") (:MN "46 00 N" "105 00 E")
65               (:MS "16 45 N" "62 12 W") (:MW "13 30 S" "34 00 E") (:ME "42 30 N" "19 18 E")
66               (:MK "41 50 N" "22 00 E") (:ML "17 00 N" "4 00 W") (:MC "43 44 N" "7 24 E")
67               (:MA "32 00 N" "5 00 W") (:MU "20 17 S" "57 33 E") (:MR "20 00 N" "12 00 W")
68               (:MT "35 50 N" "14 35 E") (:OM "21 00 N" "57 00 E") (:MV "3 15 N" "73 00 E")
69               (:MX "23 00 N" "102 00 W") (:MY "2 30 N" "112 30 E") (:MZ "18 15 S" "35 00 E")
70               (:NC "21 30 S" "165 30 E") (:NU "19 02 S" "169 52 W")
71               (:NF "29 02 S" "167 57 E") (:NE "16 00 N" "8 00 E") (:VU "16 00 S" "167 00 E")
72               (:NG "10 00 N" "8 00 E") (:NL "52 30 N" "5 45 E") (:NO "62 00 N" "10 00 E")
73               (:NP "28 00 N" "84 00 E") (:NR "0 32 S" "166 55 E") (:SR "4 00 N" "56 00 W")
74               (:AN "12 15 N" "68 45 W") (:NI "13 00 N" "85 00 W") (:NZ "41 00 S" "174 00 E")
75               (:PY "23 00 S" "58 00 W") (:PN "25 04 S" "130 06 W") (:PE "10 00 S" "76 00 W")
76               (:PK "30 00 N" "70 00 E") (:PL "52 00 N" "20 00 E") (:PA "9 00 N" "80 00 W")
77               (:PT "39 30 N" "8 00 W") (:PG "6 00 S" "147 00 E") (:PW "7 30 N" "134 30 E")
78               (:GW "12 00 N" "15 00 W") (:QA "25 30 N" "51 15 E") (:RS "44 00 N" "21 00 E")
79               (:MH "9 00 N" "168 00 E") (:MF "18 05 N" "63 57 W") (:RO "46 00 N" "25 00 E")
80               (:PH "13 00 N" "122 00 E") (:PR "18 15 N" "66 30 W")
81               (:RU "60 00 N" "100 00 E") (:RW "2 00 S" "30 00 E") (:SA "25 00 N" "45 00 E")
82               (:PM "46 50 N" "56 20 W") (:KN "17 20 N" "62 45 W") (:SC "4 35 S" "55 40 E")
83               (:ZA "29 00 S" "24 00 E") (:SN "14 00 N" "14 00 W") (:SI "46 07 N" "14 49 E")
84               (:SL "8 30 N" "11 30 W") (:SM "43 46 N" "12 25 E") (:SG "1 22 N" "103 48 E")
85               (:SO "10 00 N" "49 00 E") (:ES "40 00 N" "4 00 W") (:LC "13 53 N" "60 58 W")
86               (:SD "15 00 N" "30 00 E") (:SJ "78 00 N" "20 00 E") (:SE "62 00 N" "15 00 E")
87               (:GS "54 30 S" "37 00 W") (:SY "35 00 N" "38 00 E") (:CH "47 00 N" "8 00 E")
88               (:BL "17 90 N" "62 85 W") (:TT "11 00 N" "61 00 W") (:TH "15 00 N" "100 00 E")
89               (:TJ "39 00 N" "71 00 E") (:TC "21 45 N" "71 35 W") (:TK "9 00 S" "172 00 W")
90               (:TO "20 00 S" "175 00 W") (:TG "8 00 N" "1 10 E") (:ST "1 00 N" "7 00 E")
91               (:TN "34 00 N" "9 00 E") (:TL "8 50 S" "125 55 E") (:TR "39 00 N" "35 00 E")
92               (:TV "8 00 S" "178 00 E") (:TW "23 30 N" "121 00 E") (:TM "40 00 N" "60 00 E")
93               (:TZ "6 00 S" "35 00 E") (:UG "1 00 N" "32 00 E") (:GB "54 00 N" "2 00 W")
94               (:UA "49 00 N" "32 00 E") (:US "38 00 N" "97 00 W") (:BF "13 00 N" "2 00 W")
95               (:UY "33 00 S" "56 00 W") (:UZ "41 00 N" "64 00 E") (:VC "13 15 N" "61 12 W")
96               (:VE "8 00 N" "66 00 W") (:VG "18 30 N" "64 30 W") (:VN "16 00 N" "106 00 E")
97               (:VI "18 20 N" "64 50 W") (:VA "41 54 N" "12 27 E") (:NA "22 00 S" "17 00 E")
98               (:PS "32 00 N" "35 15 E") (:WF "13 18 S" "176 12 W") (:EH "24 30 N" "13 00 W")
99               (:WS "13 35 S" "172 20 W") (:SZ "26 30 S" "31 30 E") (:YE "15 00 N" "48 00 E")))))
100
101
102 (defvar *country-english-names* '((:AD "Andorra") (:AE "United Arab Emirates") (:AF "Afghanistan")
103                                   (:AG "Antigua and Barbuda") (:AI "Anguilla") (:AL "Albania")
104                                   (:AM "Armenia") (:AN "Netherlands Antilles") (:AO "Angola")
105                                   (:AQ "Antarctica") (:AR "Argentina") (:AS "American Samoa")
106                                   (:AT "Austria") (:AU "Australia") (:AW "Aruba")
107                                   (:AX "Ã
108 land Islands") (:AZ "Azerbaijan") (:BA "Bosnia and Herzegovina")
109                                   (:BB "Barbados") (:BD "Bangladesh") (:BE "Belgium")
110                                   (:BF "Burkina Faso") (:BG "Bulgaria") (:BH "Bahrain")
111                                   (:BI "Burundi") (:BJ "Benin") (:BL "Saint Barthélemy")
112                                   (:BM "Bermuda") (:BN "Brunei Darussalam") (:BO "Bolivia")
113                                   (:BR "Brazil") (:BS "Bahamas") (:BT "Bhutan")
114                                   (:BV "Bouvet Island") (:BW "Botswana") (:BY "Belarus")
115                                   (:BZ "Belize") (:CA "Canada") (:CC "Cocos (Keeling) Islands")
116                                   (:CD "the Democratic Republic of the Congo") (:CF "Central African Republic") (:CG "Congo")
117                                   (:CH "Switzerland") (:CI "CÃŽte d'Ivoire") (:CK "Cook Islands")
118                                   (:CL "Chile") (:CM "Cameroon") (:CN "China")
119                                   (:CO "Colombia") (:CR "Costa Rica") (:CU "Cuba")
120                                   (:CV "Cape Verde") (:CX "Christmas Island") (:CY "Cyprus")
121                                   (:CZ "Czech Republic") (:DE "Germany") (:DJ "Djibouti")
122                                   (:DK "Denmark") (:DM "Dominica") (:DO "Dominican Republic")
123                                   (:DZ "Algeria") (:EC "Ecuador") (:EE "Estonia")
124                                   (:EG "Egypt") (:EH "Western Sahara") (:ER "Eritrea")
125                                   (:ES "Spain") (:ET "Ethiopia") (:FI "Finland")
126                                   (:FJ "Fiji") (:FK "Falkland Islands (Malvinas)") (:FM "Federated States of Micronesia")
127                                   (:FO "Faroe Islands") (:FR "France") (:GA "Gabon")
128                                   (:GB "United Kingdom") (:GD "Grenada") (:GE "Georgia")
129                                   (:GF "French Guiana") (:GG "Guernsey") (:GH "Ghana")
130                                   (:GI "Gibraltar") (:GL "Greenland") (:GM "Gambia")
131                                   (:GN "Guinea") (:GP "Guadeloupe") (:GQ "Equatorial Guinea")
132                                   (:GR "Greece") (:GS "South Georgia and the South Sandwich Islands") (:GT "Guatemala")
133                                   (:GU "Guam") (:GW "Guinea-Bissau") (:GY "Guyana")
134                                   (:HK "Hong Kong") (:HM "Heard Island and McDonald Islands") (:HN "Honduras")
135                                   (:HR "Croatia") (:HT "Haiti") (:HU "Hungary")
136                                   (:ID "Indonesia") (:IE "Ireland") (:IL "Israel")
137                                   (:IM "Isle of Man") (:IN "India") (:IO "British Indian Ocean Territory")
138                                   (:IQ "Iraq") (:IR "Islamic Republic of Iran") (:IS "Iceland")
139                                   (:IT "Italy") (:JE "Jersey") (:JM "Jamaica")
140                                   (:JO "Jordan") (:JP "Japan") (:KE "Kenya")
141                                   (:KG "Kyrgyzstan") (:KH "Cambodia") (:KI "Kiribati")
142                                   (:KM "Comoros") (:KN "Saint Kitts and Nevis") (:KP "Korea")
143                                   (:KR "South Korea") (:KW "Kuwait") (:KY "Cayman Islands")
144                                   (:KZ "Kazakhstan") (:LA "Lao People's Democratic Republic") (:LB "Lebanon")
145                                   (:LC "Saint Lucia") (:LI "Liechtenstein") (:LK "Sri Lanka")
146                                   (:LR "Liberia") (:LS "Lesotho") (:LT "Lithuania")
147                                   (:LU "Luxembourg") (:LV "Latvia") (:LY "Libyan Arab Jamahiriya")
148                                   (:MA "Morocco") (:MC "Monaco") (:MD "Moldova")
149                                   (:ME "Montenegro") (:MF "Saint Martin (French part)") (:MG "Madagascar")
150                                   (:MH "Marshall Islands") (:MK "the former Yugoslav Republic of Macedonia") (:ML "Mali")
151                                   (:MM "Myanmar") (:MN "Mongolia") (:MO "Macao")
152                                   (:MP "Northern Mariana Islands") (:MQ "Martinique") (:MR "Mauritania")
153                                   (:MS "Montserrat") (:MT "Malta") (:MU "Mauritius")
154                                   (:MV "Maldives") (:MW "Malawi") (:MX "Mexico")
155                                   (:MY "Malaysia") (:MZ "Mozambique") (:NA "Namibia")
156                                   (:NC "New Caledonia") (:NE "Niger") (:NF "Norfolk Island")
157                                   (:NG "Nigeria") (:NI "Nicaragua") (:NL "Netherlands")
158                                   (:NO "Norway") (:NP "Nepal") (:NR "Nauru")
159                                   (:NU "Niue") (:NZ "New Zealand") (:OM "Oman")
160                                   (:PA "Panama") (:PE "Peru") (:PF "French Polynesia")
161                                   (:PG "Papua New Guinea") (:PH "Philippines") (:PK "Pakistan")
162                                   (:PL "Poland") (:PM "Saint Pierre and Miquelon") (:PN "Pitcairn")
163                                   (:PR "Puerto Rico") (:PS "Occupied Palestinian Territory") (:PT "Portugal")
164                                   (:PW "Palau") (:PY "Paraguay") (:QA "Qatar")
165                                   (:RE "Réunion") (:RO "Romania") (:RS "Serbia")
166                                   (:RU "Russian Federation") (:RW "Rwanda") (:SA "Saudi Arabia")
167                                   (:SB "Solomon Islands") (:SC "Seychelles") (:SD "Sudan")
168                                   (:SE "Sweden") (:SG "Singapore") (:SH "Saint Helena")
169                                   (:SI "Slovenia") (:SJ "Svalbard and Jan Mayen") (:SK "Slovakia")
170                                   (:SL "Sierra Leone") (:SM "San Marino") (:SN "Senegal")
171                                   (:SO "Somalia") (:SR "Suriname") (:ST "Sao Tome and Principe")
172                                   (:SV "El Salvador") (:SY "Syrian Arab Republic") (:SZ "Swaziland")
173                                   (:TC "Turks and Caicos Islands") (:TD "Chad") (:TF "French Southern Territories")
174                                   (:TG "Togo") (:TH "Thailand") (:TJ "Tajikistan")
175                                   (:TK "Tokelau") (:TL "Timor-Leste") (:TM "Turkmenistan")
176                                   (:TN "Tunisia") (:TO "Tonga") (:TR "Turkey")
177                                   (:TT "Trinidad and Tobago") (:TV "Tuvalu") (:TW "Taiwan")
178                                   (:TZ "United Republic of Tanzania") (:UA "Ukraine") (:UG "Uganda")
179                                   (:UM "United States Minor Outlying Islands") (:US "United States") (:UY "Uruguay")
180                                   (:UZ "Uzbekistan") (:VA "Holy See") (:VC "Saint Vincent and the Grenadines")
181                                   (:VE "Venezuela") (:VG "British Virgin Islands") (:VI "U.S. Virgin Islands")
182                                   (:VN "Viet Nam") (:VU "Vanuatu") (:WF "Wallis and Futuna")
183                                   (:WS "Samoa") (:YE "Yemen") (:YT "Mayotte")
184                                   (:ZA "South Africa") (:ZM "Zambia") (:ZW "Zimbabwe")))
Note: See TracBrowser for help on using the browser.