Just a little map to see if you know your countries capital. Simply click on a country in the map and the country as well as capital will appear. Bonus points if you can figure out what the colour coding means.
| Sort Order | Common Name | Formal Name | Type | Sub Type | Sovereignty | Capital | ISO 4217 Currency Code | ISO 4217 Currency Name | ITU-T Telephone Code | ISO 3166-1 2 Letter Code | ISO 3166-1 3 Letter Code | ISO 3166-1 Number | IANA Country Code TLD | continent | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Afghanistan | Islamic State of Afghanistan | Independent State | Kabul | AFN | Afghani | 93 | AF | AFG | 4 | .af | ASIA | |||
| 2 | Albania | Republic of Albania | Independent State | Tirana | ALL | Lek | 355 | AL | ALB | 8 | .al | EUROPE | |||
| 3 | Algeria | People's Democratic Republic of Algeria | Independent State | Algiers | DZD | Dinar | 213 | DZ | DZA | 12 | .dz | AFRICA | |||
| 4 | Andorra | Principality of Andorra | Independent State | Andorra la Vella | EUR | Euro | 376 | AD | AND | 20 | .ad | EUROPE | |||
| 5 | Angola | Republic of Angola | Independent State | Luanda | AOA | Kwanza | 244 | AO | AGO | 24 | .ao | AFRICA | |||
| 6 | Antigua and Barbuda | Independent State | Saint John's | XCD | Dollar | -267 | AG | ATG | 28 | .ag | SOUTH AMERICA | ||||
| 7 | Argentina | Argentine Republic | Independent State | Buenos Aires | ARS | Peso | 54 | AR | ARG | 32 | .ar | SOUTH AMERICA | |||
| 8 | Armenia | Republic of Armenia | Independent State | Yerevan | AMD | Dram | 374 | AM | ARM | 51 | .am | ASIA | |||
| 9 | Australia | Commonwealth of Australia | Independent State | Canberra | AUD | Dollar | 61 | AU | AUS | 36 | .au | AUSTRALIA | |||
| 10 | Austria | Republic of Austria | Independent State | Vienna | EUR | Euro | 43 | AT | AUT | 40 | .at | EUROPE | |||
| 11 | Azerbaijan | Republic of Azerbaijan | Independent State | Baku | AZN | Manat | 994 | AZ | AZE | 31 | .az | ASIA | |||
| 12 | Bahamas, The | Commonwealth of The Bahamas | Independent State | Nassau | BSD | Dollar | -241 | BS | BHS | 44 | .bs | SOUTH AMERICA | |||
| 13 | Bahrain | Kingdom of Bahrain | Independent State | Manama | BHD | Dinar | 973 | BH | BHR | 48 | .bh | ASIA | |||
| 14 | Bangladesh | People's Republic of Bangladesh | Independent State | Dhaka | BDT | Taka | 880 | BD | BGD | 50 | .bd | ASIA | |||
| 15 | Barbados | Independent State | Bridgetown | BBD | Dollar | -245 | BB | BRB | 52 | .bb | SOUTH AMERICA | ||||
| 16 | Belarus | Republic of Belarus | Independent State | Minsk | BYR | Ruble | 375 | BY | BLR | 112 | .by | EUROPE | |||
| 17 | Belgium | Kingdom of Belgium | Independent State | Brussels | EUR | Euro | 32 | BE | BEL | 56 | .be | EUROPE | |||
| 18 | Belize | Independent State | Belmopan | BZD | Dollar | 501 | BZ | BLZ | 84 | .bz | SOUTH AMERICA | ||||
| 19 | Benin | Republic of Benin | Independent State | Porto-Novo | XOF | Franc | 229 | BJ | BEN | 204 | .bj | AFRICA | |||
| 20 | Bhutan | Kingdom of Bhutan | Independent State | Thimphu | BTN | Ngultrum | 975 | BT | BTN | 64 | .bt | ASIA | |||
| 21 | Bolivia | Republic of Bolivia | Independent State | La Paz (administrative/legislative) and Sucre (judical) | BOB | Boliviano | 591 | BO | BOL | 68 | .bo | SOUTH AMERICA | |||
| 22 | Bosnia and Herzegovina | Independent State | Sarajevo | BAM | Marka | 387 | BA | BIH | 70 | .ba | EUROPE | ||||
| 23 | Botswana | Republic of Botswana | Independent State | Gaborone | BWP | Pula | 267 | BW | BWA | 72 | .bw | AFRICA | |||
| 24 | Brazil | Federative Republic of Brazil | Independent State | Brasilia | BRL | Real | 55 | BR | BRA | 76 | .br | SOUTH AMERICA | |||
| 25 | Brunei | Negara Brunei Darussalam | Independent State | Bandar Seri Begawan | BND | Dollar | 673 | BN | BRN | 96 | .bn | ASIA | |||
| 26 | Bulgaria | Republic of Bulgaria | Independent State | Sofia | BGN | Lev | 359 | BG | BGR | 100 | .bg | EUROPE | |||
| 27 | Burkina Faso | Independent State | Ouagadougou | XOF | Franc | 226 | BF | BFA | 854 | .bf | AFRICA | ||||
| 28 | Burundi | Republic of Burundi | Independent State | Bujumbura | BIF | Franc | 257 | BI | BDI | 108 | .bi | AFRICA | |||
| 29 | Cambodia | Kingdom of Cambodia | Independent State | Phnom Penh | KHR | Riels | 855 | KH | KHM | 116 | .kh | ASIA | |||
| 30 | Cameroon | Republic of Cameroon | Independent State | Yaounde | XAF | Franc | 237 | CM | CMR | 120 | .cm | AFRICA | |||
| 31 | Canada | Independent State | Ottawa | CAD | Dollar | 1 | CA | CAN | 124 | .ca | NORTH AMERICA | ||||
| 32 | Cape Verde | Republic of Cape Verde | Independent State | Praia | CVE | Escudo | 238 | CV | CPV | 132 | .cv | AFRICA | |||
| 33 | Central African Republic | Independent State | Bangui | XAF | Franc | 236 | CF | CAF | 140 | .cf | AFRICA | ||||
| 34 | Chad | Republic of Chad | Independent State | N'Djamena | XAF | Franc | 235 | TD | TCD | 148 | .td | AFRICA | |||
| 35 | Chile | Republic of Chile | Independent State | Santiago (administrative/judical) and Valparaiso (legislative) | CLP | Peso | 56 | CL | CHL | 152 | .cl | SOUTH AMERICA | |||
| 36 | China, People's Republic of | People's Republic of China | Independent State | Beijing | CNY | Yuan Renminbi | 86 | CN | CHN | 156 | .cn | ASIA | |||
| 37 | Colombia | Republic of Colombia | Independent State | Bogota | COP | Peso | 57 | CO | COL | 170 | .co | SOUTH AMERICA | |||
| 38 | Comoros | Union of Comoros | Independent State | Moroni | KMF | Franc | 269 | KM | COM | 174 | .km | AFRICA | |||
| 39 | Congo, Democratic Republic of the (Congo � Kinshasa) | Democratic Republic of the Congo | Independent State | Kinshasa | CDF | Franc | 243 | CD | COD | 180 | .cd | AFRICA | |||
| 40 | Congo, Republic of the (Congo � Brazzaville) | Republic of the Congo | Independent State | Brazzaville | XAF | Franc | 242 | CG | COG | 178 | .cg | AFRICA | |||
| 41 | Costa Rica | Republic of Costa Rica | Independent State | San Jose | CRC | Colon | 506 | CR | CRI | 188 | .cr | SOUTH AMERICA | |||
| 42 | Cote d'Ivoire (Ivory Coast) | Republic of Cote d'Ivoire | Independent State | Yamoussoukro | XOF | Franc | 225 | CI | CIV | 384 | .ci | AFRICA | |||
| 43 | Croatia | Republic of Croatia | Independent State | Zagreb | HRK | Kuna | 385 | HR | HRV | 191 | .hr | EUROPE | |||
| 44 | Cuba | Republic of Cuba | Independent State | Havana | CUP | Peso | 53 | CU | CUB | 192 | .cu | SOUTH AMERICA | |||
| 45 | Cyprus | Republic of Cyprus | Independent State | Nicosia | CYP | Pound | 357 | CY | CYP | 196 | .cy | EUROPE | |||
| 46 | Czech Republic | Independent State | Prague | CZK | Koruna | 420 | CZ | CZE | 203 | .cz | EUROPE | ||||
| 47 | Denmark | Kingdom of Denmark | Independent State | Copenhagen | DKK | Krone | 45 | DK | DNK | 208 | .dk | EUROPE | |||
| 48 | Djibouti | Republic of Djibouti | Independent State | Djibouti | DJF | Franc | 253 | DJ | DJI | 262 | .dj | AFRICA | |||
| 49 | Dominica | Commonwealth of Dominica | Independent State | Roseau | XCD | Dollar | -766 | DM | DMA | 212 | .dm | SOUTH AMERICA | |||
| 50 | Dominican Republic | Independent State | Santo Domingo | DOP | Peso | +1-809 and 1-829 | DO | DOM | 214 | .do | SOUTH AMERICA | ||||
| 51 | Ecuador | Republic of Ecuador | Independent State | Quito | USD | Dollar | 593 | EC | ECU | 218 | .ec | SOUTH AMERICA | |||
| 52 | Egypt | Arab Republic of Egypt | Independent State | Cairo | EGP | Pound | 20 | EG | EGY | 818 | .eg | AFRICA | |||
| 53 | El Salvador | Republic of El Salvador | Independent State | San Salvador | USD | Dollar | 503 | SV | SLV | 222 | .sv | SOUTH AMERICA | |||
| 54 | Equatorial Guinea | Republic of Equatorial Guinea | Independent State | Malabo | XAF | Franc | 240 | GQ | GNQ | 226 | .gq | AFRICA | |||
| 55 | Eritrea | State of Eritrea | Independent State | Asmara | ERN | Nakfa | 291 | ER | ERI | 232 | .er | AFRICA | |||
| 56 | Estonia | Republic of Estonia | Independent State | Tallinn | EEK | Kroon | 372 | EE | EST | 233 | .ee | EUROPE | |||
| 57 | Ethiopia | Federal Democratic Republic of Ethiopia | Independent State | Addis Ababa | ETB | Birr | 251 | ET | ETH | 231 | .et | AFRICA | |||
| 58 | Fiji | Republic of the Fiji Islands | Independent State | Suva | FJD | Dollar | 679 | FJ | FJI | 242 | .fj | PACIFIC | |||
| 59 | Finland | Republic of Finland | Independent State | Helsinki | EUR | Euro | 358 | FI | FIN | 246 | .fi | EUROPE | |||
| 60 | France | French Republic | Independent State | Paris | EUR | Euro | 33 | FR | FRA | 250 | .fr | EUROPE | |||
| 61 | Gabon | Gabonese Republic | Independent State | Libreville | XAF | Franc | 241 | GA | GAB | 266 | .ga | AFRICA | |||
| 62 | Gambia, The | Republic of The Gambia | Independent State | Banjul | GMD | Dalasi | 220 | GM | GMB | 270 | .gm | AFRICA | |||
| 63 | Georgia | Republic of Georgia | Independent State | Tbilisi | GEL | Lari | 995 | GE | GEO | 268 | .ge | ASIA | |||
| 64 | Germany | Federal Republic of Germany | Independent State | Berlin | EUR | Euro | 49 | DE | DEU | 276 | .de | EUROPE | |||
| 65 | Ghana | Republic of Ghana | Independent State | Accra | GHS | Cedi | 233 | GH | GHA | 288 | .gh | AFRICA | |||
| 66 | Greece | Hellenic Republic | Independent State | Athens | EUR | Euro | 30 | GR | GRC | 300 | .gr | EUROPE | |||
| 67 | Grenada | Independent State | Saint George's | XCD | Dollar | -472 | GD | GRD | 308 | .gd | SOUTH AMERICA | ||||
| 68 | Guatemala | Republic of Guatemala | Independent State | Guatemala | GTQ | Quetzal | 502 | GT | GTM | 320 | .gt | SOUTH AMERICA | |||
| 69 | Guinea | Republic of Guinea | Independent State | Conakry | GNF | Franc | 224 | GN | GIN | 324 | .gn | AFRICA | |||
| 70 | Guinea-Bissau | Republic of Guinea-Bissau | Independent State | Bissau | XOF | Franc | 245 | GW | GNB | 624 | .gw | AFRICA | |||
| 71 | Guyana | Co-operative Republic of Guyana | Independent State | Georgetown | GYD | Dollar | 592 | GY | GUY | 328 | .gy | SOUTH AMERICA | |||
| 72 | Haiti | Republic of Haiti | Independent State | Port-au-Prince | HTG | Gourde | 509 | HT | HTI | 332 | .ht | SOUTH AMERICA | |||
| 73 | Honduras | Republic of Honduras | Independent State | Tegucigalpa | HNL | Lempira | 504 | HN | HND | 340 | .hn | SOUTH AMERICA | |||
| 74 | Hungary | Republic of Hungary | Independent State | Budapest | HUF | Forint | 36 | HU | HUN | 348 | .hu | EUROPE | |||
| 75 | Iceland | Republic of Iceland | Independent State | Reykjavik | ISK | Krona | 354 | IS | ISL | 352 | .is | EUROPE | |||
| 76 | India | Republic of India | Independent State | New Delhi | INR | Rupee | 91 | IN | IND | 356 | .in | ASIA | |||
| 77 | Indonesia | Republic of Indonesia | Independent State | Jakarta | IDR | Rupiah | 62 | ID | IDN | 360 | .id | ASIA | |||
| 78 | Iran | Islamic Republic of Iran | Independent State | Tehran | IRR | Rial | 98 | IR | IRN | 364 | .ir | ASIA | |||
| 79 | Iraq | Republic of Iraq | Independent State | Baghdad | IQD | Dinar | 964 | IQ | IRQ | 368 | .iq | ASIA | |||
| 80 | Ireland | Independent State | Dublin | EUR | Euro | 353 | IE | IRL | 372 | .ie | EUROPE | ||||
| 81 | Israel | State of Israel | Independent State | Jerusalem | ILS | Shekel | 972 | IL | ISR | 376 | .il | ASIA | |||
| 82 | Italy | Italian Republic | Independent State | Rome | EUR | Euro | 39 | IT | ITA | 380 | .it | EUROPE | |||
| 83 | Jamaica | Independent State | Kingston | JMD | Dollar | -875 | JM | JAM | 388 | .jm | SOUTH AMERICA | ||||
| 84 | Japan | Independent State | Tokyo | JPY | Yen | 81 | JP | JPN | 392 | .jp | ASIA | ||||
| 85 | Jordan | Hashemite Kingdom of Jordan | Independent State | Amman | JOD | Dinar | 962 | JO | JOR | 400 | .jo | ASIA | |||
| 86 | Kazakhstan | Republic of Kazakhstan | Independent State | Astana | KZT | Tenge | 7 | KZ | KAZ | 398 | .kz | ASIA | |||
| 87 | Kenya | Republic of Kenya | Independent State | Nairobi | KES | Shilling | 254 | KE | KEN | 404 | .ke | AFRICA | |||
| 88 | Kiribati | Republic of Kiribati | Independent State | Tarawa | AUD | Dollar | 686 | KI | KIR | 296 | .ki | AUSTRALIA | |||
| 89 | Korea, Democratic People's Republic of (North Korea) | Democratic People's Republic of Korea | Independent State | Pyongyang | KPW | Won | 850 | KP | PRK | 408 | .kp | ASIA | |||
| 90 | Korea, Republic of (South Korea) | Republic of Korea | Independent State | Seoul | KRW | Won | 82 | KR | KOR | 410 | .kr | ASIA | |||
| 91 | Kuwait | State of Kuwait | Independent State | Kuwait | KWD | Dinar | 965 | KW | KWT | 414 | .kw | ASIA | |||
| 92 | Kyrgyzstan | Kyrgyz Republic | Independent State | Bishkek | KGS | Som | 996 | KG | KGZ | 417 | .kg | ASIA | |||
| 93 | Laos | Lao People's Democratic Republic | Independent State | Vientiane | LAK | Kip | 856 | LA | LAO | 418 | .la | ASIA | |||
| 94 | Latvia | Republic of Latvia | Independent State | Riga | LVL | Lat | 371 | LV | LVA | 428 | .lv | EUROPE | |||
| 95 | Lebanon | Lebanese Republic | Independent State | Beirut | LBP | Pound | 961 | LB | LBN | 422 | .lb | ASIA | |||
| 96 | Lesotho | Kingdom of Lesotho | Independent State | Maseru | LSL | Loti | 266 | LS | LSO | 426 | .ls | AFRICA | |||
| 97 | Liberia | Republic of Liberia | Independent State | Monrovia | LRD | Dollar | 231 | LR | LBR | 430 | .lr | AFRICA | |||
| 98 | Libya | Great Socialist People's Libyan Arab Jamahiriya | Independent State | Tripoli | LYD | Dinar | 218 | LY | LBY | 434 | .ly | AFRICA | |||
| 99 | Liechtenstein | Principality of Liechtenstein | Independent State | Vaduz | CHF | Franc | 423 | LI | LIE | 438 | .li | EUROPE | |||
| 100 | Lithuania | Republic of Lithuania | Independent State | Vilnius | LTL | Litas | 370 | LT | LTU | 440 | .lt | EUROPE | |||
| 101 | Luxembourg | Grand Duchy of Luxembourg | Independent State | Luxembourg | EUR | Euro | 352 | LU | LUX | 442 | .lu | EUROPE | |||
| 102 | Macedonia | Republic of Macedonia | Independent State | Skopje | MKD | Denar | 389 | MK | MKD | 807 | .mk | EUROPE | |||
| 103 | Madagascar | Republic of Madagascar | Independent State | Antananarivo | MGA | Ariary | 261 | MG | MDG | 450 | .mg | AFRICA | |||
| 104 | Malawi | Republic of Malawi | Independent State | Lilongwe | MWK | Kwacha | 265 | MW | MWI | 454 | .mw | AFRICA | |||
| 105 | Malaysia | Independent State | Kuala Lumpur (legislative/judical) and Putrajaya (administrative) | MYR | Ringgit | 60 | MY | MYS | 458 | .my | ASIA | ||||
| 106 | Maldives | Republic of Maldives | Independent State | Male | MVR | Rufiyaa | 960 | MV | MDV | 462 | .mv | ASIA | |||
| 107 | Mali | Republic of Mali | Independent State | Bamako | XOF | Franc | 223 | ML | MLI | 466 | .ml | AFRICA | |||
| 108 | Malta | Republic of Malta | Independent State | Valletta | MTL | Lira | 356 | MT | MLT | 470 | .mt | EUROPE | |||
| 109 | Marshall Islands | Republic of the Marshall Islands | Independent State | Majuro | USD | Dollar | 692 | MH | MHL | 584 | .mh | PACIFIC | |||
| 110 | Mauritania | Islamic Republic of Mauritania | Independent State | Nouakchott | MRO | Ouguiya | 222 | MR | MRT | 478 | .mr | AFRICA | |||
| 111 | Mauritius | Republic of Mauritius | Independent State | Port Louis | MUR | Rupee | 230 | MU | MUS | 480 | .mu | AFRICA | |||
| 112 | Mexico | United Mexican States | Independent State | Mexico | MXN | Peso | 52 | MX | MEX | 484 | .mx | SOUTH AMERICA | |||
| 113 | Micronesia | Federated States of Micronesia | Independent State | Palikir | USD | Dollar | 691 | FM | FSM | 583 | .fm | PACIFIC | |||
| 114 | Moldova | Republic of Moldova | Independent State | Chisinau | MDL | Leu | 373 | MD | MDA | 498 | .md | EUROPE | |||
| 115 | Monaco | Principality of Monaco | Independent State | Monaco | EUR | Euro | 377 | MC | MCO | 492 | .mc | EUROPE | |||
| 116 | Mongolia | Independent State | Ulaanbaatar | MNT | Tugrik | 976 | MN | MNG | 496 | .mn | ASIA | ||||
| 117 | Montenegro | Republic of Montenegro | Independent State | Podgorica | EUR | Euro | 382 | ME | MNE | 499 | .me and .yu | EUROPE | |||
| 118 | Morocco | Kingdom of Morocco | Independent State | Rabat | MAD | Dirham | 212 | MA | MAR | 504 | .ma | AFRICA | |||
| 119 | Mozambique | Republic of Mozambique | Independent State | Maputo | MZM | Meticail | 258 | MZ | MOZ | 508 | .mz | AFRICA | |||
| 120 | Myanmar (Burma) | Union of Myanmar | Independent State | Naypyidaw | MMK | Kyat | 95 | MM | MMR | 104 | .mm | ASIA | |||
| 121 | Namibia | Republic of Namibia | Independent State | Windhoek | NAD | Dollar | 264 | NA | NAM | 516 | .na | AFRICA | |||
| 122 | Nauru | Republic of Nauru | Independent State | Yaren | AUD | Dollar | 674 | NR | NRU | 520 | .nr | PACIFIC | |||
| 123 | Nepal | Independent State | Kathmandu | NPR | Rupee | 977 | NP | NPL | 524 | .np | ASIA | ||||
| 124 | Netherlands | Kingdom of the Netherlands | Independent State | Amsterdam (administrative) and The Hague (legislative/judical) | EUR | Euro | 31 | NL | NLD | 528 | .nl | EUROPE | |||
| 125 | New Zealand | Independent State | Wellington | NZD | Dollar | 64 | NZ | NZL | 554 | .nz | PACIFIC | ||||
| 126 | Nicaragua | Republic of Nicaragua | Independent State | Managua | NIO | Cordoba | 505 | NI | NIC | 558 | .ni | SOUTH AMERICA | |||
| 127 | Niger | Republic of Niger | Independent State | Niamey | XOF | Franc | 227 | NE | NER | 562 | .ne | AFRICA | |||
| 128 | Nigeria | Federal Republic of Nigeria | Independent State | Abuja | NGN | Naira | 234 | NG | NGA | 566 | .ng | AFRICA | |||
| 129 | Norway | Kingdom of Norway | Independent State | Oslo | NOK | Krone | 47 | NO | NOR | 578 | .no | EUROPE | |||
| 130 | Oman | Sultanate of Oman | Independent State | Muscat | OMR | Rial | 968 | OM | OMN | 512 | .om | ASIA | |||
| 131 | Pakistan | Islamic Republic of Pakistan | Independent State | Islamabad | PKR | Rupee | 92 | PK | PAK | 586 | .pk | ASIA | |||
| 132 | Palau | Republic of Palau | Independent State | Melekeok | USD | Dollar | 680 | PW | PLW | 585 | .pw | PACIFIC | |||
| 133 | Panama | Republic of Panama | Independent State | Panama | PAB | Balboa | 507 | PA | PAN | 591 | .pa | SOUTH AMERICA | |||
| 134 | Papua New Guinea | Independent State of Papua New Guinea | Independent State | Port Moresby | PGK | Kina | 675 | PG | PNG | 598 | .pg | PACIFIC | |||
| 135 | Paraguay | Republic of Paraguay | Independent State | Asuncion | PYG | Guarani | 595 | PY | PRY | 600 | .py | SOUTH AMERICA | |||
| 136 | Peru | Republic of Peru | Independent State | Lima | PEN | Sol | 51 | PE | PER | 604 | .pe | SOUTH AMERICA | |||
| 137 | Philippines | Republic of the Philippines | Independent State | Manila | PHP | Peso | 63 | PH | PHL | 608 | .ph | ASIA | |||
| 138 | Poland | Republic of Poland | Independent State | Warsaw | PLN | Zloty | 48 | PL | POL | 616 | .pl | EUROPE | |||
| 139 | Portugal | Portuguese Republic | Independent State | Lisbon | EUR | Euro | 351 | PT | PRT | 620 | .pt | EUROPE | |||
| 140 | Qatar | State of Qatar | Independent State | Doha | QAR | Rial | 974 | QA | QAT | 634 | .qa | ASIA | |||
| 141 | Romania | Independent State | Bucharest | RON | Leu | 40 | RO | ROU | 642 | .ro | EUROPE | ||||
| 142 | Russia | Russian Federation | Independent State | Moscow | RUB | Ruble | 7 | RU | RUS | 643 | .ru and .su | ASIA | |||
| 143 | Rwanda | Republic of Rwanda | Independent State | Kigali | RWF | Franc | 250 | RW | RWA | 646 | .rw | AFRICA | |||
| 144 | Saint Kitts and Nevis | Federation of Saint Kitts and Nevis | Independent State | Basseterre | XCD | Dollar | -868 | KN | KNA | 659 | .kn | SOUTH AMERICA | |||
| 145 | Saint Lucia | Independent State | Castries | XCD | Dollar | -757 | LC | LCA | 662 | .lc | SOUTH AMERICA | ||||
| 146 | Saint Vincent and the Grenadines | Independent State | Kingstown | XCD | Dollar | -783 | VC | VCT | 670 | .vc | SOUTH AMERICA | ||||
| 147 | Samoa | Independent State of Samoa | Independent State | Apia | WST | Tala | 685 | WS | WSM | 882 | .ws | AUSTRALIA | |||
| 148 | San Marino | Republic of San Marino | Independent State | San Marino | EUR | Euro | 378 | SM | SMR | 674 | .sm | EUROPE | |||
| 149 | Sao Tome and Principe | Democratic Republic of Sao Tome and Principe | Independent State | Sao Tome | STD | Dobra | 239 | ST | STP | 678 | .st | AFRICA | |||
| 150 | Saudi Arabia | Kingdom of Saudi Arabia | Independent State | Riyadh | SAR | Rial | 966 | SA | SAU | 682 | .sa | ASIA | |||
| 151 | Senegal | Republic of Senegal | Independent State | Dakar | XOF | Franc | 221 | SN | SEN | 686 | .sn | AFRICA | |||
| 152 | Serbia | Republic of Serbia | Independent State | Belgrade | RSD | Dinar | 381 | RS | SRB | 688 | .rs and .yu | EUROPE | |||
| 153 | Seychelles | Republic of Seychelles | Independent State | Victoria | SCR | Rupee | 248 | SC | SYC | 690 | .sc | AFRICA | |||
| 154 | Sierra Leone | Republic of Sierra Leone | Independent State | Freetown | SLL | Leone | 232 | SL | SLE | 694 | .sl | AFRICA | |||
| 155 | Singapore | Republic of Singapore | Independent State | Singapore | SGD | Dollar | 65 | SG | SGP | 702 | .sg | ASIA | |||
| 156 | Slovakia | Slovak Republic | Independent State | Bratislava | SKK | Koruna | 421 | SK | SVK | 703 | .sk | EUROPE | |||
| 157 | Slovenia | Republic of Slovenia | Independent State | Ljubljana | EUR | Euro | 386 | SI | SVN | 705 | .si | EUROPE | |||
| 158 | Solomon Islands | Independent State | Honiara | SBD | Dollar | 677 | SB | SLB | 90 | .sb | PACIFIC | ||||
| 159 | Somalia | Independent State | Mogadishu | SOS | Shilling | 252 | SO | SOM | 706 | .so | AFRICA | ||||
| 160 | South Africa | Republic of South Africa | Independent State | Pretoria (administrative), Cape Town (legislative), and Bloemfontein (judical) | ZAR | Rand | 27 | ZA | ZAF | 710 | .za | AFRICA | |||
| 161 | Spain | Kingdom of Spain | Independent State | Madrid | EUR | Euro | 34 | ES | ESP | 724 | .es | EUROPE | |||
| 162 | Sri Lanka | Democratic Socialist Republic of Sri Lanka | Independent State | Colombo (administrative/judical) and Sri Jayewardenepura Kotte (legislative) | LKR | Rupee | 94 | LK | LKA | 144 | .lk | ASIA | |||
| 163 | Sudan | Republic of the Sudan | Independent State | Khartoum | SDG | Pound | 249 | SD | SDN | 729 | .sd | AFRICA | |||
| 164 | Suriname | Republic of Suriname | Independent State | Paramaribo | SRD | Dollar | 597 | SR | SUR | 740 | .sr | SOUTH AMERICA | |||
| 165 | Swaziland | Kingdom of Swaziland | Independent State | Mbabane (administrative) and Lobamba (legislative) | SZL | Lilangeni | 268 | SZ | SWZ | 748 | .sz | AFRICA | |||
| 166 | Sweden | Kingdom of Sweden | Independent State | Stockholm | SEK | Kronoa | 46 | SE | SWE | 752 | .se | EUROPE | |||
| 167 | Switzerland | Swiss Confederation | Independent State | Bern | CHF | Franc | 41 | CH | CHE | 756 | .ch | EUROPE | |||
| 168 | Syria | Syrian Arab Republic | Independent State | Damascus | SYP | Pound | 963 | SY | SYR | 760 | .sy | ASIA | |||
| 169 | Tajikistan | Republic of Tajikistan | Independent State | Dushanbe | TJS | Somoni | 992 | TJ | TJK | 762 | .tj | ASIA | |||
| 170 | Tanzania | United Republic of Tanzania | Independent State | Dar es Salaam (administrative/judical) and Dodoma (legislative) | TZS | Shilling | 255 | TZ | TZA | 834 | .tz | AFRICA | |||
| 171 | Thailand | Kingdom of Thailand | Independent State | Bangkok | THB | Baht | 66 | TH | THA | 764 | .th | ASIA | |||
| 172 | Timor-Leste (East Timor) | Democratic Republic of Timor-Leste | Independent State | Dili | USD | Dollar | 670 | TL | TLS | 626 | .tp and .tl | ASIA | |||
| 173 | Togo | Togolese Republic | Independent State | Lome | XOF | Franc | 228 | TG | TGO | 768 | .tg | AFRICA | |||
| 174 | Tonga | Kingdom of Tonga | Independent State | Nuku'alofa | TOP | Pa'anga | 676 | TO | TON | 776 | .to | PACIFIC | |||
| 175 | Trinidad and Tobago | Republic of Trinidad and Tobago | Independent State | Port-of-Spain | TTD | Dollar | -867 | TT | TTO | 780 | .tt | SOUTH AMERICA | |||
| 176 | Tunisia | Tunisian Republic | Independent State | Tunis | TND | Dinar | 216 | TN | TUN | 788 | .tn | AFRICA | |||
| 177 | Turkey | Republic of Turkey | Independent State | Ankara | TRY | Lira | 90 | TR | TUR | 792 | .tr | EUROPE | |||
| 178 | Turkmenistan | Independent State | Ashgabat | TMM | Manat | 993 | TM | TKM | 795 | .tm | ASIA | ||||
| 179 | Tuvalu | Independent State | Funafuti | AUD | Dollar | 688 | TV | TUV | 798 | .tv | PACIFIC | ||||
| 180 | Uganda | Republic of Uganda | Independent State | Kampala | UGX | Shilling | 256 | UG | UGA | 800 | .ug | AFRICA | |||
| 181 | Ukraine | Independent State | Kiev | UAH | Hryvnia | 380 | UA | UKR | 804 | .ua | EUROPE | ||||
| 182 | United Arab Emirates | United Arab Emirates | Independent State | Abu Dhabi | AED | Dirham | 971 | AE | ARE | 784 | .ae | ASIA | |||
| 183 | United Kingdom | United Kingdom of Great Britain and Northern Ireland | Independent State | London | GBP | Pound | 44 | GB | GBR | 826 | .uk | EUROPE | |||
| 184 | United States | United States of America | Independent State | Washington | USD | Dollar | 1 | US | USA | 840 | .us | NORTH AMERICA | |||
| 185 | Uruguay | Oriental Republic of Uruguay | Independent State | Montevideo | UYU | Peso | 598 | UY | URY | 858 | .uy | SOUTH AMERICA | |||
| 186 | Uzbekistan | Republic of Uzbekistan | Independent State | Tashkent | UZS | Som | 998 | UZ | UZB | 860 | .uz | ASIA | |||
| 187 | Vanuatu | Republic of Vanuatu | Independent State | Port-Vila | VUV | Vatu | 678 | VU | VUT | 548 | .vu | PACIFIC | |||
| 188 | Vatican City | State of the Vatican City | Independent State | Vatican City | EUR | Euro | 379 | VA | VAT | 336 | .va | EUROPE | |||
| 189 | Venezuela | Bolivarian Republic of Venezuela | Independent State | Caracas | VEB | Bolivar | 58 | VE | VEN | 862 | .ve | SOUTH AMERICA | |||
| 190 | Vietnam | Socialist Republic of Vietnam | Independent State | Hanoi | VND | Dong | 84 | VN | VNM | 704 | .vn | ASIA | |||
| 191 | Yemen | Republic of Yemen | Independent State | Sanaa | YER | Rial | 967 | YE | YEM | 887 | .ye | ASIA | |||
| 192 | Zambia | Republic of Zambia | Independent State | Lusaka | ZMK | Kwacha | 260 | ZM | ZMB | 894 | .zm | AFRICA | |||
| 193 | Zimbabwe | Republic of Zimbabwe | Independent State | Harare | ZWD | Dollar | 263 | ZW | ZWE | 716 | .zw | AFRICA | |||
| 194 | Abkhazia | Republic of Abkhazia | Proto Independent State | Sokhumi | RUB | Ruble | 995 | GE | GEO | 268 | .ge | EUROPE | |||
| 195 | China, Republic of (Taiwan) | Republic of China | Proto Independent State | Taipei | TWD | Dollar | 886 | TW | TWN | 158 | .tw | ASIA | |||
| 196 | Nagorno-Karabakh | Nagorno-Karabakh Republic | Proto Independent State | Stepanakert | AMD | Dram | 277 | AZ | AZE | 31 | .az | EUROPE | |||
| 197 | Northern Cyprus | Turkish Republic of Northern Cyprus | Proto Independent State | Nicosia | TRY | Lira | -302 | CY | CYP | 196 | .nc.tr | EUROPE | |||
| 198 | Pridnestrovie (Transnistria) | Pridnestrovian Moldavian Republic | Proto Independent State | Tiraspol | Ruple | -160 | MD | MDA | 498 | .md | EUROPE | ||||
| 199 | Somaliland | Republic of Somaliland | Proto Independent State | Hargeisa | Shilling | 252 | SO | SOM | 706 | .so | AFRICA | ||||
| 200 | South Ossetia | Republic of South Ossetia | Proto Independent State | Tskhinvali | RUB and GEL | Ruble and Lari | 995 | GE | GEO | 268 | .ge | EUROPE | |||
| 201 | Ashmore and Cartier Islands | Territory of Ashmore and Cartier Islands | Dependency | External Territory | Australia | AU | AUS | 36 | .au | AUSTRALIA | |||||
| 202 | Christmas Island | Territory of Christmas Island | Dependency | External Territory | Australia | The Settlement (Flying Fish Cove) | AUD | Dollar | 61 | CX | CXR | 162 | .cx | AUSTRALIA | |
| 203 | Cocos (Keeling) Islands | Territory of Cocos (Keeling) Islands | Dependency | External Territory | Australia | West Island | AUD | Dollar | 61 | CC | CCK | 166 | .cc | AUSTRALIA | |
| 204 | Coral Sea Islands | Coral Sea Islands Territory | Dependency | External Territory | Australia | AU | AUS | 36 | .au | AUSTRALIA | |||||
| 205 | Heard Island and McDonald Islands | Territory of Heard Island and McDonald Islands | Dependency | External Territory | Australia | HM | HMD | 334 | .hm | ANTARCTICA | |||||
| 206 | Norfolk Island | Territory of Norfolk Island | Dependency | External Territory | Australia | Kingston | AUD | Dollar | 672 | NF | NFK | 574 | .nf | AUSTRALIA | |
| 207 | New Caledonia | Dependency | Sui generis Collectivity | France | Noumea | XPF | Franc | 687 | NC | NCL | 540 | .nc | PACIFIC | ||
| 208 | French Polynesia | Overseas Country of French Polynesia | Dependency | Overseas Collectivity | France | Papeete | XPF | Franc | 689 | PF | PYF | 258 | .pf | PACIFIC | |
| 209 | Mayotte | Departmental Collectivity of Mayotte | Dependency | Overseas Collectivity | France | Mamoudzou | EUR | Euro | 262 | YT | MYT | 175 | .yt | AFRICA | |
| 210 | Saint Barthelemy | Collectivity of Saint Barthelemy | Dependency | Overseas Collectivity | France | Gustavia | EUR | Euro | 590 | GP | GLP | 312 | .gp | NORTH AMERICA | |
| 211 | Saint Martin | Collectivity of Saint Martin | Dependency | Overseas Collectivity | France | Marigot | EUR | Euro | 590 | GP | GLP | 312 | .gp | NORTH AMERICA | |
| 212 | Saint Pierre and Miquelon | Territorial Collectivity of Saint Pierre and Miquelon | Dependency | Overseas Collectivity | France | Saint-Pierre | EUR | Euro | 508 | PM | SPM | 666 | .pm | NORTH AMERICA | |
| 213 | Wallis and Futuna | Collectivity of the Wallis and Futuna Islands | Dependency | Overseas Collectivity | France | Mata'utu | XPF | Franc | 681 | WF | WLF | 876 | .wf | AUSTRALIA | |
| 214 | French Southern and Antarctic Lands | Territory of the French Southern and Antarctic Lands | Dependency | Overseas Territory | France | Martin-de-Vivi�s | TF | ATF | 260 | .tf | ANTARCTICA | ||||
| 215 | Clipperton Island | Dependency | Possession | France | PF | PYF | 258 | .pf | NORTH AMERICA | ||||||
| 216 | Bouvet Island | Dependency | Territory | Norway | BV | BVT | 74 | .bv | ANTARCTICA | ||||||
| 217 | Cook Islands | Dependency | Self-Governing in Free Association | New Zealand | Avarua | NZD | Dollar | 682 | CK | COK | 184 | .ck | PACIFIC | ||
| 218 | Niue | Dependency | Self-Governing in Free Association | New Zealand | Alofi | NZD | Dollar | 683 | NU | NIU | 570 | .nu | PACIFIC | ||
| 219 | Tokelau | Dependency | Territory | New Zealand | NZD | Dollar | 690 | TK | TKL | 772 | .tk | PACIFIC | |||
| 220 | Guernsey | Bailiwick of Guernsey | Dependency | Crown Dependency | United Kingdom | Saint Peter Port | GGP | Pound | 44 | GG | GGY | 831 | .gg | EUROPE | |
| 221 | Isle of Man | Dependency | Crown Dependency | United Kingdom | Douglas | IMP | Pound | 44 | IM | IMN | 833 | .im | EUROPE | ||
| 222 | Jersey | Bailiwick of Jersey | Dependency | Crown Dependency | United Kingdom | Saint Helier | JEP | Pound | 44 | JE | JEY | 832 | .je | EUROPE | |
| 223 | Anguilla | Dependency | Overseas Territory | United Kingdom | The Valley | XCD | Dollar | -263 | AI | AIA | 660 | .ai | NORTH AMERICA | ||
| 224 | Bermuda | Dependency | Overseas Territory | United Kingdom | Hamilton | BMD | Dollar | -440 | BM | BMU | 60 | .bm | NORTH AMERICA | ||
| 225 | British Indian Ocean Territory | Dependency | Overseas Territory | United Kingdom | 246 | IO | IOT | 86 | .io | ASIA | |||||
| 226 | British Sovereign Base Areas | Dependency | Overseas Territory | United Kingdom | Episkopi | CYP | Pound | 357 | NA | ||||||
| 227 | British Virgin Islands | Dependency | Overseas Territory | United Kingdom | Road Town | USD | Dollar | -283 | VG | VGB | 92 | .vg | NA | ||
| 228 | Cayman Islands | Dependency | Overseas Territory | United Kingdom | George Town | KYD | Dollar | -344 | KY | CYM | 136 | .ky | NORTH AMERICA | ||
| 229 | Falkland Islands (Islas Malvinas) | Dependency | Overseas Territory | United Kingdom | Stanley | FKP | Pound | 500 | FK | FLK | 238 | .fk | SOUTH AMERICA | ||
| 230 | Gibraltar | Dependency | Overseas Territory | United Kingdom | Gibraltar | GIP | Pound | 350 | GI | GIB | 292 | .gi | EUROPE | ||
| 231 | Montserrat | Dependency | Overseas Territory | United Kingdom | Plymouth | XCD | Dollar | -663 | MS | MSR | 500 | .ms | EUROPE | ||
| 232 | Pitcairn Islands | Dependency | Overseas Territory | United Kingdom | Adamstown | NZD | Dollar | PN | PCN | 612 | .pn | PACIFIC | |||
| 233 | Saint Helena | Dependency | Overseas Territory | United Kingdom | Jamestown | SHP | Pound | 290 | SH | SHN | 654 | .sh | AFRICA | ||
| 234 | South Georgia and the South Sandwich Islands | Dependency | Overseas Territory | United Kingdom | GS | SGS | 239 | .gs | SOUTH AMERICA | ||||||
| 235 | Turks and Caicos Islands | Dependency | Overseas Territory | United Kingdom | Grand Turk | USD | Dollar | -648 | TC | TCA | 796 | .tc | NORTH AMERICA | ||
| 236 | Northern Mariana Islands | Commonwealth of The Northern Mariana Islands | Dependency | Commonwealth | United States | Saipan | USD | Dollar | -669 | MP | MNP | 580 | .mp | ASIA | |
| 237 | Puerto Rico | Commonwealth of Puerto Rico | Dependency | Commonwealth | United States | San Juan | USD | Dollar | +1-787 and 1-939 | PR | PRI | 630 | .pr | SOUTH AMERICA | |
| 238 | American Samoa | Territory of American Samoa | Dependency | Territory | United States | Pago Pago | USD | Dollar | -683 | AS | ASM | 16 | .as | PACIFIC | |
| 239 | Baker Island | Dependency | Territory | United States | UM | UMI | 581 | PACIFIC | |||||||
| 240 | Guam | Territory of Guam | Dependency | Territory | United States | Hagatna | USD | Dollar | -670 | GU | GUM | 316 | .gu | PACIFIC | |
| 241 | Howland Island | Dependency | Territory | United States | UM | UMI | 581 | PACIFIC | |||||||
| 242 | Jarvis Island | Dependency | Territory | United States | UM | UMI | 581 | PACIFIC | |||||||
| 243 | Johnston Atoll | Dependency | Territory | United States | UM | UMI | 581 | PACIFIC | |||||||
| 244 | Kingman Reef | Dependency | Territory | United States | UM | UMI | 581 | PACIFIC | |||||||
| 245 | Midway Islands | Dependency | Territory | United States | UM | UMI | 581 | PACIFIC | |||||||
| 246 | Navassa Island | Dependency | Territory | United States | UM | UMI | 581 | NORTH AMERICA | |||||||
| 247 | Palmyra Atoll | Dependency | Territory | United States | UM | UMI | 581 | PACIFIC | |||||||
| 248 | U.S. Virgin Islands | United States Virgin Islands | Dependency | Territory | United States | Charlotte Amalie | USD | Dollar | -339 | VI | VIR | 850 | .vi | PACIFIC | |
| 249 | Wake Island | Dependency | Territory | United States | UM | UMI | 850 | PACIFIC | |||||||
| 250 | Hong Kong | Hong Kong Special Administrative Region | Proto Dependency | Special Administrative Region | China | HKD | Dollar | 852 | HK | HKG | 344 | .hk | ASIA | ||
| 251 | Macau | Macau Special Administrative Region | Proto Dependency | Special Administrative Region | China | Macau | MOP | Pataca | 853 | MO | MAC | 446 | .mo | ASIA | |
| 252 | Faroe Islands | Proto Dependency | Denmark | Torshavn | DKK | Krone | 298 | FO | FRO | 234 | .fo | EUROPE | |||
| 253 | Greenland | Proto Dependency | Denmark | Nuuk (Godthab) | DKK | Krone | 299 | GL | GRL | 304 | .gl | NORTH AMERICA | |||
| 254 | French Guiana | Overseas Region of Guiana | Proto Dependency | Overseas Region | France | Cayenne | EUR | Euro | 594 | GF | GUF | 254 | .gf | SOUTH AMERICA | |
| 255 | Guadeloupe | Overseas Region of Guadeloupe | Proto Dependency | Overseas Region | France | Basse-Terre | EUR | Euro | 590 | GP | GLP | 312 | .gp | NORTH AMERICA | |
| 256 | Martinique | Overseas Region of Martinique | Proto Dependency | Overseas Region | France | Fort-de-France | EUR | Euro | 596 | MQ | MTQ | 474 | .mq | NORTH AMERICA | |
| 257 | Reunion | Overseas Region of Reunion | Proto Dependency | Overseas Region | France | Saint-Denis | EUR | Euro | 262 | RE | REU | 638 | .re | AFRICA | |
| 258 | Aland | Proto Dependency | Finland | Mariehamn | EUR | Euro | 340 | AX | ALA | 248 | .ax | EUROPE | |||
| 259 | Aruba | Proto Dependency | Netherlands | Oranjestad | AWG | Guilder | 297 | AW | ABW | 533 | .aw | EUROPE | |||
| 260 | Netherlands Antilles | Proto Dependency | Netherlands | Willemstad | ANG | Guilder | 599 | AN | ANT | 530 | .an | SOUTH AMERICA | |||
| 261 | Svalbard | Proto Dependency | Norway | Longyearbyen | NOK | Krone | 47 | SJ | SJM | 744 | .sj | EUROPE | |||
| 262 | Ascension | Proto Dependency | Dependency of Saint Helena | United Kingdom | Georgetown | SHP | Pound | 247 | AC | ASC | .ac | EUROPE | |||
| 263 | Tristan da Cunha | Proto Dependency | Dependency of Saint Helena | United Kingdom | Edinburgh | SHP | Pound | 290 | TA | TAA | NA | ||||
| 264 | Antarctica | Disputed Territory | Undetermined | AQ | ATA | 10 | .aq | ANTARCTICA | |||||||
| 265 | Kosovo | Disputed Territory | Administrated by the UN | Pristina | CSD and EUR | Dinar and Euro | 381 | CS | SCG | 891 | .cs and .yu | EUROPE | |||
| 266 | Palestinian Territories (Gaza Strip and West Bank) | Disputed Territory | Administrated by Israel | Gaza City (Gaza Strip) and Ramallah (West Bank) | ILS | Shekel | 970 | PS | PSE | 275 | .ps | ASIA | |||
| 267 | Western Sahara | Disputed Territory | Administrated by Morocco | El-Aaiun | MAD | Dirham | 212 | EH | ESH | 732 | .eh | AFRICA | |||
| 268 | Australian Antarctic Territory | Antarctic Territory | External Territory | Australia | AQ | ATA | 10 | .aq | ANTARCTICA | ||||||
| 269 | Ross Dependency | Antarctic Territory | Territory | New Zealand | AQ | ATA | 10 | .aq | ANTARCTICA | ||||||
| 270 | Peter I Island | Antarctic Territory | Territory | Norway | AQ | ATA | 10 | .aq | ANTARCTICA | ||||||
| 271 | Queen Maud Land | Antarctic Territory | Territory | Norway | AQ | ATA | 10 | .aq | ANTARCTICA | ||||||
| 272 | British Antarctic Territory | Antarctic Territory | Overseas Territory | United Kingdom | AQ | ATA | 10 | .aq | ANTARCTICA | ||||||
| 273 | South Sudan | Juba | SS | SSD | 728 | .od | AFRICA |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| <title>Countries and thier capitals</title> | |
| <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
| <script src="http://d3js.org/topojson.v1.min.js"?></script> | |
| <script src="http://d3js.org/d3.geo.polyhedron.v0.min.js"></script> | |
| <script src="http://d3js.org/d3.geo.projection.v0.min.js"></script> | |
| <style type="text/css"> | |
| h1 { | |
| font-family: Courier New; | |
| color: #525252; | |
| } | |
| text { | |
| font-family: Courier New; | |
| font-size: 18px; | |
| fill: #525252; | |
| } | |
| .hLable { | |
| font-weight: bold; | |
| } | |
| #wrapper { | |
| margin-left: auto; | |
| margin-right: auto; | |
| width: 1160px; | |
| } | |
| .graticule { | |
| fill: none; | |
| stroke: #000; | |
| stroke-opacity: .6; | |
| stroke-width: .5px; | |
| } | |
| .graticule.outline { | |
| fill: #9ecae1; | |
| opacity: 0.2; | |
| stroke: #333; | |
| stroke-opacity: 1; | |
| stroke-width: 1.5px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div id="wrapper"> | |
| <h1>Name that Country and its Capital</h1> | |
| <div id="map"></div> | |
| </div> | |
| </body> | |
| <script type="text/javascript"> | |
| var h = 750, | |
| w = 1160, | |
| p = 5, | |
| l = 20, | |
| m = { | |
| top: 0, | |
| bottom: 0, | |
| left: 0, | |
| right: 0, | |
| labels: 200 | |
| }; | |
| var colours = ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0", "#f0027f", "#bf5b17", "#666666", "#7F7F7F"]; | |
| // set-up unit projection and path | |
| var projection = d3.geo.kavrayskiy7() | |
| .scale(1) | |
| .translate([0, 0]); | |
| var path = d3.geo.path() | |
| .projection(projection); | |
| var graticule = d3.geo.graticule(); | |
| // set-up svg canvas | |
| var svg = d3.select("#map").append("svg") | |
| .attr("height", h) | |
| .attr("width", w); | |
| svg.append("text") | |
| .attr("id", "hCountry") | |
| .attr("class", "hLable") | |
| .attr("x", m.left) | |
| .attr("y", m.top + l) | |
| .text("Country:"); | |
| svg.append("text") | |
| .attr("id", "hCapital") | |
| .attr("class", "hLable") | |
| .attr("x", m.left) | |
| .attr("y", m.top + 2 * l) | |
| .text("Capital:"); | |
| // set-up scale for colour coding continents | |
| var cScale = d3.scale.ordinal() | |
| .range(colours); | |
| // read in topojson of world | |
| d3.json("50m.json", function(error, countries) { | |
| d3.csv("countrylist.csv", function(error, capitals) { | |
| allContinenets = []; | |
| capitals.forEach(function(d, i) { | |
| var el = d.continent; | |
| allContinenets.push(el); | |
| }); | |
| var continents = arrayUnique(allContinenets); | |
| cScale.domain(continents); | |
| var bTopo = topojson.feature(countries, countries.objects.countries) | |
| topo = bTopo.features; | |
| topo = topo.filter(function(d) { | |
| return capitals.some(function(n) { | |
| if (+d.id == +n["ISO 3166-1 Number"]) { | |
| if (+d.id === 729) console.log(d) | |
| return d.country = n["Common Name"], | |
| d.capital = n["Capital"], | |
| d.continent = n["continent"]; | |
| } else { | |
| return d.country = null, | |
| d.capital = null, | |
| d.continent = null; | |
| } | |
| }); | |
| }).sort(function(a, b) { | |
| return a.country.localeCompare(b.country); | |
| }); | |
| // calculate bounds, scale and transform | |
| // see http://stackoverflow.com/questions/14492284/center-a-map-in-d3-given-a-geojson-object | |
| var b = path.bounds(bTopo), | |
| s = .95 / Math.max((b[1][0] - b[0][0]) / w, (b[1][1] - b[0][1]) / h), | |
| t = [(w - s * (b[1][0] + b[0][0])) / 2, (h - s * (b[1][1] + b[0][1])) / 2]; | |
| projection.scale(s) | |
| .translate(t); | |
| svg.append("path") | |
| .datum(graticule) | |
| .attr("class", "graticule") | |
| .attr("d", path); | |
| svg.append("path") | |
| .datum(graticule.outline) | |
| .attr("class", "graticule outline") | |
| .attr("d", path); | |
| var paths = svg.append("g").selectAll("path") | |
| .data(topo).enter() | |
| .append("path") | |
| .style("fill", function(d, i) { | |
| return cScale(d.continent) | |
| }) | |
| .style("stroke", "black") | |
| .attr("d", path) | |
| .attr("pointer-events", "all"); | |
| paths.on("click", function(d) { | |
| addLabels(d); | |
| }); | |
| }); | |
| }); | |
| function addLabels(d) { | |
| var cnt = document.getElementById('hCountry'), | |
| cntLength = cnt.getComputedTextLength(); | |
| var countryTag = svg.selectAll(".countryLable") | |
| .data([d]) | |
| countryTag.enter() | |
| .append("text") | |
| .attr("class", "countryLable") | |
| .attr("x", cntLength + p) | |
| .attr("y", m.top + l); | |
| countryTag.text(function(d) { | |
| return d.country; | |
| }); | |
| countryTag.exit().remove(); | |
| var capitalTag = svg.selectAll(".capitalLable") | |
| .data([d]) | |
| var cap = document.getElementById('hCapital'), | |
| capLength = cap.getComputedTextLength(); | |
| capitalTag.enter() | |
| .append("text") | |
| .attr("class", "capitalLable") | |
| .attr("x", cntLength + p) | |
| .attr("y", m.top + 2 * l); | |
| capitalTag.text(function(d) { | |
| return d.capital; | |
| }); | |
| capitalTag.exit().remove(); | |
| } | |
| //http:stackoverflow.com/questions/13486479/how-to-get-an-array-of-unique-values-from-an-array-containing-duplicates-in-java | |
| var arrayUnique = function(a) { | |
| return a.reduce(function(p, c) { | |
| if (p.indexOf(c) < 0) p.push(c); | |
| return p; | |
| }, []); | |
| }; | |
| </script> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment