-
-
Save vincentpham1991/d058bdbb8b570863722c47e797aeab50 to your computer and use it in GitHub Desktop.
Drag to Rotate the Globe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> | |
<script src="https://d3js.org/d3.v5.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.19/topojson.min.js"></script> | |
<style type="text/css"> | |
.land{ | |
fill: rgba(0,0,0, 0.17); | |
} | |
.border{ | |
stroke: rgba(0,0,0, 0.7); | |
fill: none; | |
} | |
path:hover { | |
fill-opacity:.7; | |
} | |
/* Style for Custom Tooltip */ | |
initialMessage.tooltip { | |
position: absolute; | |
text-align: center; | |
width: 325px; | |
height: 40px; | |
padding: 2px; | |
font: 25px bold, sans-serif; | |
border: 0px; | |
border-radius: 8px; | |
pointer-events: none; | |
} | |
div.tooltip { | |
position: absolute; | |
text-align: center; | |
width: 200px; | |
height: 40px; | |
padding: 2px; | |
font: 30px bold, sans-serif; | |
border: 0px; | |
border-radius: 8px; | |
pointer-events: none; | |
} | |
message.tooltip { | |
position: absolute; | |
text-align: center; | |
width: 200px; | |
height: 40px; | |
padding: 2px; | |
font: 12px bold, sans-serif; | |
border: 0px; | |
border-radius: 8px; | |
pointer-events: none; | |
color: red; | |
} | |
</style> | |
</head> | |
<body> | |
<script> | |
// D3 Projection parameters | |
var width = 960, | |
height = 500, | |
initRotation = [70, -20], | |
sensitivity = 0.25, | |
scaleExtent = [1, 8], | |
maxElevation = 45; | |
// D3 Projection | |
var projection = d3.geoOrthographic() | |
.scale(250) | |
.rotate(initRotation) | |
.translate([width / 2, height / 2]) | |
.clipAngle(90); | |
var path = d3.geoPath() | |
.projection(projection); | |
// Define linear scale for color output of country visited | |
var color = d3.scaleLinear() | |
.range(["rgb(213,222,217)","rgb(69,173,168)"]); | |
var svg = d3.select("body") | |
.append("svg") | |
.attr("width", width) | |
.attr("height", height) | |
.call(d3.drag() | |
.subject(function () { | |
var r = projection.rotate(); | |
return { x: r[0] / sensitivity, y: -r[1] / sensitivity }; | |
}) | |
.on("drag", dragged) | |
) | |
.call(d3.zoom() | |
.scaleExtent(scaleExtent) | |
.on("zoom", zoomed) | |
); | |
// Append Div for tooltip to SVG | |
var initialMessage = d3.select("body") | |
.append("initialMessage") | |
.attr("class", "tooltip") | |
.style("opacity", 1) | |
.text("DRAG THE GLOBE AND HOVER OVER THE COUNTRIES") | |
.style("left", "0px") | |
.style("top", "0px"); | |
var div = d3.select("body") | |
.append("div") | |
.attr("class", "tooltip") | |
.style("opacity", 0); | |
var message = d3.select("body") | |
.append("message") | |
.attr("class", "tooltip") | |
.style("opacity", 0); | |
//Drag Functions | |
function dragged() { | |
var o1 = [d3.event.x * sensitivity, -d3.event.y * sensitivity]; | |
o1[1] = | |
o1[1] > maxElevation | |
? maxElevation | |
: o1[1] < -maxElevation | |
? -maxElevation | |
: o1[1]; | |
projection.rotate(o1); | |
refresh(); | |
} | |
function zoomed() { | |
if (d3.event) { | |
svg.attr("transform", "scale(" + d3.event.transform.k + ")"); | |
} | |
} | |
function refresh() { | |
svg.selectAll(".land").attr("d", path); | |
svg.selectAll(".border").attr("d", path); | |
svg.selectAll(".g").attr("d", path); | |
} | |
// Date Files | |
var files = [d3.json("world-110m.json"), | |
d3.csv("world-country-names.csv")]; | |
Promise.all(files).then(mapData); | |
// Create the Globe | |
function mapData(data){ | |
var world = data[0]; | |
var country_names = data[1]; | |
var countries = topojson.feature(world, world.objects.countries).features; | |
var borders = topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; }); | |
// Assign the land colors ("visited") | |
color.domain([0,1]); | |
// Apply country data to json data | |
for (var i = 0; i < country_names.length; i++) { | |
var name = country_names[i].name; | |
var country_id = Number(country_names[i].id); | |
var visited = Number(country_names[i].visited); | |
var website = country_names[i].website; | |
for (var j = 0; j < countries.length; j++) { | |
var original_id = countries[j].id; | |
if (original_id === country_id) { | |
countries[j].properties.visited = visited; | |
countries[j].properties.name = name; | |
countries[j].properties.website = website; | |
break; | |
} | |
} | |
} | |
//Display the borders between countries | |
svg.append("path") | |
.datum(borders) | |
.attr("class", "border") | |
.attr("d", path); | |
// Apply land color, hover, and double click feature | |
svg.append("g") | |
.attr("class", "land") | |
.selectAll("path") | |
.data(countries) | |
.enter() | |
.append("path") | |
.attr("d", path) | |
.style("stroke", "#fff") | |
.style("stroke-width", "1") | |
.style("fill", function(d) { | |
// Get data value | |
var value = d.properties.visited; | |
if (value) { | |
return color(value); | |
} else { | |
return "rgb(213,222,217)"; | |
} | |
}) | |
.attr("class", "land") | |
.on("mouseover", function(d) { | |
initialMessage.transition() | |
.duration(100) | |
.style("opacity", 0); | |
div.transition() | |
.duration(200) | |
.style("opacity", 0.9); | |
div.text(d.properties.name) | |
.style("left", "0px") | |
.style("top", "0px"); | |
if (d.properties.website) { | |
message.transition() | |
.duration(200) | |
.style("opacity", 0.9); | |
message.text('Double Click for Country Map') | |
.style("left", "0px") | |
.style("top", "300px"); | |
} | |
}) | |
// fade out tooltip on mouse out | |
.on("mouseout", function() { | |
div.transition() | |
.duration(500) | |
.style("opacity", 0); | |
message.transition() | |
.duration(500) | |
.style("opacity", 0); | |
}) | |
.on("dblclick", function(d) { | |
var website = d.properties.website; | |
if(website){ | |
window.open("http://vincentpham1991.github.io/blog/" + website, "_blank"); | |
} | |
}); | |
} | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name | alpha-2 | alpha-3 | id | iso_3166-2 | region | sub-region | region-code | sub-region-code | visited | website | |
---|---|---|---|---|---|---|---|---|---|---|---|
Afghanistan | AF | AFG | 4 | ISO 3166-2:AF | Asia | Southern Asia | 142 | 34 | 0 | ||
Aland Islands | AX | ALA | 248 | ISO 3166-2:AX | Europe | Northern Europe | 150 | 154 | 0 | ||
Albania | AL | ALB | 8 | ISO 3166-2:AL | Europe | Southern Europe | 150 | 39 | 0 | ||
Algeria | DZ | DZA | 12 | ISO 3166-2:DZ | Africa | Northern Africa | 2 | 15 | 0 | ||
American Samoa | AS | ASM | 16 | ISO 3166-2:AS | Oceania | Polynesia | 9 | 61 | 0 | ||
Andorra | AD | AND | 20 | ISO 3166-2:AD | Europe | Southern Europe | 150 | 39 | 0 | ||
Angola | AO | AGO | 24 | ISO 3166-2:AO | Africa | Middle Africa | 2 | 17 | 0 | ||
Anguilla | AI | AIA | 660 | ISO 3166-2:AI | Americas | Caribbean | 19 | 29 | 0 | ||
Antarctica | AQ | ATA | 10 | ISO 3166-2:AQ | 0 | ||||||
Antigua and Barbuda | AG | ATG | 28 | ISO 3166-2:AG | Americas | Caribbean | 19 | 29 | 0 | ||
Argentina | AR | ARG | 32 | ISO 3166-2:AR | Americas | South America | 19 | 5 | 0 | ||
Armenia | AM | ARM | 51 | ISO 3166-2:AM | Asia | Western Asia | 142 | 145 | 0 | ||
Aruba | AW | ABW | 533 | ISO 3166-2:AW | Americas | Caribbean | 19 | 29 | 0 | ||
Australia | AU | AUS | 36 | ISO 3166-2:AU | Oceania | Australia and New Zealand | 9 | 53 | 1 | AustraliaTravels | |
Austria | AT | AUT | 40 | ISO 3166-2:AT | Europe | Western Europe | 150 | 155 | 0 | ||
Azerbaijan | AZ | AZE | 31 | ISO 3166-2:AZ | Asia | Western Asia | 142 | 145 | 0 | ||
Bahamas | BS | BHS | 44 | ISO 3166-2:BS | Americas | Caribbean | 19 | 29 | 0 | ||
Bahrain | BH | BHR | 48 | ISO 3166-2:BH | Asia | Western Asia | 142 | 145 | 0 | ||
Bangladesh | BD | BGD | 50 | ISO 3166-2:BD | Asia | Southern Asia | 142 | 34 | 0 | ||
Barbados | BB | BRB | 52 | ISO 3166-2:BB | Americas | Caribbean | 19 | 29 | 0 | ||
Belarus | BY | BLR | 112 | ISO 3166-2:BY | Europe | Eastern Europe | 150 | 151 | 0 | ||
Belgium | BE | BEL | 56 | ISO 3166-2:BE | Europe | Western Europe | 150 | 155 | 0 | ||
Belize | BZ | BLZ | 84 | ISO 3166-2:BZ | Americas | Central America | 19 | 13 | 0 | ||
Benin | BJ | BEN | 204 | ISO 3166-2:BJ | Africa | Western Africa | 2 | 11 | 0 | ||
Bermuda | BM | BMU | 60 | ISO 3166-2:BM | Americas | Northern America | 19 | 21 | 0 | ||
Bhutan | BT | BTN | 64 | ISO 3166-2:BT | Asia | Southern Asia | 142 | 34 | 0 | ||
Bolivia (Plurinational State of) | BO | BOL | 68 | ISO 3166-2:BO | Americas | South America | 19 | 5 | 0 | ||
Bonaire, Sint Eustatius and Saba | BQ | BES | 535 | ISO 3166-2:BQ | Americas | Caribbean | 19 | 29 | 0 | ||
Bosnia and Herzegovina | BA | BIH | 70 | ISO 3166-2:BA | Europe | Southern Europe | 150 | 39 | 0 | ||
Botswana | BW | BWA | 72 | ISO 3166-2:BW | Africa | Southern Africa | 2 | 18 | 0 | ||
Bouvet Island | BV | BVT | 74 | ISO 3166-2:BV | 0 | ||||||
Brazil | BR | BRA | 76 | ISO 3166-2:BR | Americas | South America | 19 | 5 | 0 | ||
British Indian Ocean Territory | IO | IOT | 86 | ISO 3166-2:IO | 0 | ||||||
Brunei Darussalam | BN | BRN | 96 | ISO 3166-2:BN | Asia | South-Eastern Asia | 142 | 35 | 0 | ||
Bulgaria | BG | BGR | 100 | ISO 3166-2:BG | Europe | Eastern Europe | 150 | 151 | 0 | ||
Burkina Faso | BF | BFA | 854 | ISO 3166-2:BF | Africa | Western Africa | 2 | 11 | 0 | ||
Burundi | BI | BDI | 108 | ISO 3166-2:BI | Africa | Eastern Africa | 2 | 14 | 0 | ||
Cambodia | KH | KHM | 116 | ISO 3166-2:KH | Asia | South-Eastern Asia | 142 | 35 | 0 | ||
Cameroon | CM | CMR | 120 | ISO 3166-2:CM | Africa | Middle Africa | 2 | 17 | 0 | ||
Canada | CA | CAN | 124 | ISO 3166-2:CA | Americas | Northern America | 19 | 21 | 1 | ||
Cabo Verde | CV | CPV | 132 | ISO 3166-2:CV | Africa | Western Africa | 2 | 11 | 0 | ||
Cayman Islands | KY | CYM | 136 | ISO 3166-2:KY | Americas | Caribbean | 19 | 29 | 0 | ||
Central African Republic | CF | CAF | 140 | ISO 3166-2:CF | Africa | Middle Africa | 2 | 17 | 0 | ||
Chad | TD | TCD | 148 | ISO 3166-2:TD | Africa | Middle Africa | 2 | 17 | 0 | ||
Chile | CL | CHL | 152 | ISO 3166-2:CL | Americas | South America | 19 | 5 | 0 | ||
China | CN | CHN | 156 | ISO 3166-2:CN | Asia | Eastern Asia | 142 | 30 | 0 | ||
Christmas Island | CX | CXR | 162 | ISO 3166-2:CX | 0 | ||||||
Cocos (Keeling) Islands | CC | CCK | 166 | ISO 3166-2:CC | 0 | ||||||
Colombia | CO | COL | 170 | ISO 3166-2:CO | Americas | South America | 19 | 5 | 0 | ||
Comoros | KM | COM | 174 | ISO 3166-2:KM | Africa | Eastern Africa | 2 | 14 | 0 | ||
Congo | CG | COG | 178 | ISO 3166-2:CG | Africa | Middle Africa | 2 | 17 | 0 | ||
Congo (Democratic Republic of the) | CD | COD | 180 | ISO 3166-2:CD | Africa | Middle Africa | 2 | 17 | 0 | ||
Cook Islands | CK | COK | 184 | ISO 3166-2:CK | Oceania | Polynesia | 9 | 61 | 0 | ||
Costa Rica | CR | CRI | 188 | ISO 3166-2:CR | Americas | Central America | 19 | 13 | 0 | ||
Ivory Coast | CI | CIV | 384 | ISO 3166-2:CI | Africa | Western Africa | 2 | 11 | 0 | ||
Croatia | HR | HRV | 191 | ISO 3166-2:HR | Europe | Southern Europe | 150 | 39 | 0 | ||
Cuba | CU | CUB | 192 | ISO 3166-2:CU | Americas | Caribbean | 19 | 29 | 0 | ||
Curacao | CW | CUW | 531 | ISO 3166-2:CW | Americas | Caribbean | 19 | 29 | 0 | ||
Cyprus | CY | CYP | 196 | ISO 3166-2:CY | Asia | Western Asia | 142 | 145 | 0 | ||
Czech Republic | CZ | CZE | 203 | ISO 3166-2:CZ | Europe | Eastern Europe | 150 | 151 | 0 | ||
Denmark | DK | DNK | 208 | ISO 3166-2:DK | Europe | Northern Europe | 150 | 154 | 0 | ||
Djibouti | DJ | DJI | 262 | ISO 3166-2:DJ | Africa | Eastern Africa | 2 | 14 | 0 | ||
Dominica | DM | DMA | 212 | ISO 3166-2:DM | Americas | Caribbean | 19 | 29 | 0 | ||
Dominican Republic | DO | DOM | 214 | ISO 3166-2:DO | Americas | Caribbean | 19 | 29 | 0 | ||
Ecuador | EC | ECU | 218 | ISO 3166-2:EC | Americas | South America | 19 | 5 | 0 | ||
Egypt | EG | EGY | 818 | ISO 3166-2:EG | Africa | Northern Africa | 2 | 15 | 0 | ||
El Salvador | SV | SLV | 222 | ISO 3166-2:SV | Americas | Central America | 19 | 13 | 0 | ||
Equatorial Guinea | GQ | GNQ | 226 | ISO 3166-2:GQ | Africa | Middle Africa | 2 | 17 | 0 | ||
Eritrea | ER | ERI | 232 | ISO 3166-2:ER | Africa | Eastern Africa | 2 | 14 | 0 | ||
Estonia | EE | EST | 233 | ISO 3166-2:EE | Europe | Northern Europe | 150 | 154 | 0 | ||
Ethiopia | ET | ETH | 231 | ISO 3166-2:ET | Africa | Eastern Africa | 2 | 14 | 0 | ||
Falkland Islands (Malvinas) | FK | FLK | 238 | ISO 3166-2:FK | Americas | South America | 19 | 5 | 0 | ||
Faroe Islands | FO | FRO | 234 | ISO 3166-2:FO | Europe | Northern Europe | 150 | 154 | 0 | ||
Fiji | FJ | FJI | 242 | ISO 3166-2:FJ | Oceania | Melanesia | 9 | 54 | 0 | ||
Finland | FI | FIN | 246 | ISO 3166-2:FI | Europe | Northern Europe | 150 | 154 | 0 | ||
France | FR | FRA | 250 | ISO 3166-2:FR | Europe | Western Europe | 150 | 155 | 0 | ||
French Guiana | GF | GUF | 254 | ISO 3166-2:GF | Americas | South America | 19 | 5 | 0 | ||
French Polynesia | PF | PYF | 258 | ISO 3166-2:PF | Oceania | Polynesia | 9 | 61 | 0 | ||
French Southern Territories | TF | ATF | 260 | ISO 3166-2:TF | 0 | ||||||
Gabon | GA | GAB | 266 | ISO 3166-2:GA | Africa | Middle Africa | 2 | 17 | 0 | ||
Gambia | GM | GMB | 270 | ISO 3166-2:GM | Africa | Western Africa | 2 | 11 | 0 | ||
Georgia | GE | GEO | 268 | ISO 3166-2:GE | Asia | Western Asia | 142 | 145 | 0 | ||
Germany | DE | DEU | 276 | ISO 3166-2:DE | Europe | Western Europe | 150 | 155 | 0 | ||
Ghana | GH | GHA | 288 | ISO 3166-2:GH | Africa | Western Africa | 2 | 11 | 0 | ||
Gibraltar | GI | GIB | 292 | ISO 3166-2:GI | Europe | Southern Europe | 150 | 39 | 0 | ||
Greece | GR | GRC | 300 | ISO 3166-2:GR | Europe | Southern Europe | 150 | 39 | 1 | GreeceTravels | |
Greenland | GL | GRL | 304 | ISO 3166-2:GL | Americas | Northern America | 19 | 21 | 0 | ||
Grenada | GD | GRD | 308 | ISO 3166-2:GD | Americas | Caribbean | 19 | 29 | 0 | ||
Guadeloupe | GP | GLP | 312 | ISO 3166-2:GP | Americas | Caribbean | 19 | 29 | 0 | ||
Guam | GU | GUM | 316 | ISO 3166-2:GU | Oceania | Micronesia | 9 | 57 | 0 | ||
Guatemala | GT | GTM | 320 | ISO 3166-2:GT | Americas | Central America | 19 | 13 | 0 | ||
Guernsey | GG | GGY | 831 | ISO 3166-2:GG | Europe | Northern Europe | 150 | 154 | 0 | ||
Guinea | GN | GIN | 324 | ISO 3166-2:GN | Africa | Western Africa | 2 | 11 | 0 | ||
Guinea-Bissau | GW | GNB | 624 | ISO 3166-2:GW | Africa | Western Africa | 2 | 11 | 0 | ||
Guyana | GY | GUY | 328 | ISO 3166-2:GY | Americas | South America | 19 | 5 | 0 | ||
Haiti | HT | HTI | 332 | ISO 3166-2:HT | Americas | Caribbean | 19 | 29 | 0 | ||
Heard Island and McDonald Islands | HM | HMD | 334 | ISO 3166-2:HM | 0 | ||||||
Holy See | VA | VAT | 336 | ISO 3166-2:VA | Europe | Southern Europe | 150 | 39 | 0 | ||
Honduras | HN | HND | 340 | ISO 3166-2:HN | Americas | Central America | 19 | 13 | 0 | ||
Hong Kong | HK | HKG | 344 | ISO 3166-2:HK | Asia | Eastern Asia | 142 | 30 | 0 | ||
Hungary | HU | HUN | 348 | ISO 3166-2:HU | Europe | Eastern Europe | 150 | 151 | 0 | ||
Iceland | IS | ISL | 352 | ISO 3166-2:IS | Europe | Northern Europe | 150 | 154 | 0 | ||
India | IN | IND | 356 | ISO 3166-2:IN | Asia | Southern Asia | 142 | 34 | 0 | ||
Indonesia | ID | IDN | 360 | ISO 3166-2:ID | Asia | South-Eastern Asia | 142 | 35 | 0 | ||
Iran (Islamic Republic of) | IR | IRN | 364 | ISO 3166-2:IR | Asia | Southern Asia | 142 | 34 | 0 | ||
Iraq | IQ | IRQ | 368 | ISO 3166-2:IQ | Asia | Western Asia | 142 | 145 | 0 | ||
Ireland | IE | IRL | 372 | ISO 3166-2:IE | Europe | Northern Europe | 150 | 154 | 0 | ||
Isle of Man | IM | IMN | 833 | ISO 3166-2:IM | Europe | Northern Europe | 150 | 154 | 0 | ||
Israel | IL | ISR | 376 | ISO 3166-2:IL | Asia | Western Asia | 142 | 145 | 0 | ||
Italy | IT | ITA | 380 | ISO 3166-2:IT | Europe | Southern Europe | 150 | 39 | 1 | ||
Jamaica | JM | JAM | 388 | ISO 3166-2:JM | Americas | Caribbean | 19 | 29 | 0 | ||
Japan | JP | JPN | 392 | ISO 3166-2:JP | Asia | Eastern Asia | 142 | 30 | 0 | ||
Jersey | JE | JEY | 832 | ISO 3166-2:JE | Europe | Northern Europe | 150 | 154 | 0 | ||
Jordan | JO | JOR | 400 | ISO 3166-2:JO | Asia | Western Asia | 142 | 145 | 0 | ||
Kazakhstan | KZ | KAZ | 398 | ISO 3166-2:KZ | Asia | Central Asia | 142 | 143 | 0 | ||
Kenya | KE | KEN | 404 | ISO 3166-2:KE | Africa | Eastern Africa | 2 | 14 | 0 | ||
Kiribati | KI | KIR | 296 | ISO 3166-2:KI | Oceania | Micronesia | 9 | 57 | 0 | ||
Korea (Democratic People's Republic of) | KP | PRK | 408 | ISO 3166-2:KP | Asia | Eastern Asia | 142 | 30 | 0 | ||
Korea (Republic of) | KR | KOR | 410 | ISO 3166-2:KR | Asia | Eastern Asia | 142 | 30 | 0 | ||
Kuwait | KW | KWT | 414 | ISO 3166-2:KW | Asia | Western Asia | 142 | 145 | 0 | ||
Kyrgyzstan | KG | KGZ | 417 | ISO 3166-2:KG | Asia | Central Asia | 142 | 143 | 0 | ||
Lao People's Democratic Republic | LA | LAO | 418 | ISO 3166-2:LA | Asia | South-Eastern Asia | 142 | 35 | 0 | ||
Latvia | LV | LVA | 428 | ISO 3166-2:LV | Europe | Northern Europe | 150 | 154 | 0 | ||
Lebanon | LB | LBN | 422 | ISO 3166-2:LB | Asia | Western Asia | 142 | 145 | 0 | ||
Lesotho | LS | LSO | 426 | ISO 3166-2:LS | Africa | Southern Africa | 2 | 18 | 0 | ||
Liberia | LR | LBR | 430 | ISO 3166-2:LR | Africa | Western Africa | 2 | 11 | 0 | ||
Libya | LY | LBY | 434 | ISO 3166-2:LY | Africa | Northern Africa | 2 | 15 | 0 | ||
Liechtenstein | LI | LIE | 438 | ISO 3166-2:LI | Europe | Western Europe | 150 | 155 | 0 | ||
Lithuania | LT | LTU | 440 | ISO 3166-2:LT | Europe | Northern Europe | 150 | 154 | 0 | ||
Luxembourg | LU | LUX | 442 | ISO 3166-2:LU | Europe | Western Europe | 150 | 155 | 0 | ||
Macao | MO | MAC | 446 | ISO 3166-2:MO | Asia | Eastern Asia | 142 | 30 | 0 | ||
Macedonia (the former Yugoslav Republic of) | MK | MKD | 807 | ISO 3166-2:MK | Europe | Southern Europe | 150 | 39 | 0 | ||
Madagascar | MG | MDG | 450 | ISO 3166-2:MG | Africa | Eastern Africa | 2 | 14 | 0 | ||
Malawi | MW | MWI | 454 | ISO 3166-2:MW | Africa | Eastern Africa | 2 | 14 | 0 | ||
Malaysia | MY | MYS | 458 | ISO 3166-2:MY | Asia | South-Eastern Asia | 142 | 35 | 0 | ||
Maldives | MV | MDV | 462 | ISO 3166-2:MV | Asia | Southern Asia | 142 | 34 | 0 | ||
Mali | ML | MLI | 466 | ISO 3166-2:ML | Africa | Western Africa | 2 | 11 | 0 | ||
Malta | MT | MLT | 470 | ISO 3166-2:MT | Europe | Southern Europe | 150 | 39 | 0 | ||
Marshall Islands | MH | MHL | 584 | ISO 3166-2:MH | Oceania | Micronesia | 9 | 57 | 0 | ||
Martinique | MQ | MTQ | 474 | ISO 3166-2:MQ | Americas | Caribbean | 19 | 29 | 0 | ||
Mauritania | MR | MRT | 478 | ISO 3166-2:MR | Africa | Western Africa | 2 | 11 | 0 | ||
Mauritius | MU | MUS | 480 | ISO 3166-2:MU | Africa | Eastern Africa | 2 | 14 | 0 | ||
Mayotte | YT | MYT | 175 | ISO 3166-2:YT | Africa | Eastern Africa | 2 | 14 | 0 | ||
Mexico | MX | MEX | 484 | ISO 3166-2:MX | Americas | Central America | 19 | 13 | 1 | ||
Micronesia (Federated States of) | FM | FSM | 583 | ISO 3166-2:FM | Oceania | Micronesia | 9 | 57 | 0 | ||
Moldova (Republic of) | MD | MDA | 498 | ISO 3166-2:MD | Europe | Eastern Europe | 150 | 151 | 0 | ||
Monaco | MC | MCO | 492 | ISO 3166-2:MC | Europe | Western Europe | 150 | 155 | 0 | ||
Mongolia | MN | MNG | 496 | ISO 3166-2:MN | Asia | Eastern Asia | 142 | 30 | 0 | ||
Montenegro | ME | MNE | 499 | ISO 3166-2:ME | Europe | Southern Europe | 150 | 39 | 0 | ||
Montserrat | MS | MSR | 500 | ISO 3166-2:MS | Americas | Caribbean | 19 | 29 | 0 | ||
Morocco | MA | MAR | 504 | ISO 3166-2:MA | Africa | Northern Africa | 2 | 15 | 0 | ||
Mozambique | MZ | MOZ | 508 | ISO 3166-2:MZ | Africa | Eastern Africa | 2 | 14 | 0 | ||
Myanmar | MM | MMR | 104 | ISO 3166-2:MM | Asia | South-Eastern Asia | 142 | 35 | 0 | ||
Namibia | NA | NAM | 516 | ISO 3166-2:NA | Africa | Southern Africa | 2 | 18 | 0 | ||
Nauru | NR | NRU | 520 | ISO 3166-2:NR | Oceania | Micronesia | 9 | 57 | 0 | ||
Nepal | NP | NPL | 524 | ISO 3166-2:NP | Asia | Southern Asia | 142 | 34 | 0 | ||
Netherlands | NL | NLD | 528 | ISO 3166-2:NL | Europe | Western Europe | 150 | 155 | 0 | ||
New Caledonia | NC | NCL | 540 | ISO 3166-2:NC | Oceania | Melanesia | 9 | 54 | 0 | ||
New Zealand | NZ | NZL | 554 | ISO 3166-2:NZ | Oceania | Australia and New Zealand | 9 | 53 | 0 | ||
Nicaragua | NI | NIC | 558 | ISO 3166-2:NI | Americas | Central America | 19 | 13 | 0 | ||
Niger | NE | NER | 562 | ISO 3166-2:NE | Africa | Western Africa | 2 | 11 | 0 | ||
Nigeria | NG | NGA | 566 | ISO 3166-2:NG | Africa | Western Africa | 2 | 11 | 0 | ||
Niue | NU | NIU | 570 | ISO 3166-2:NU | Oceania | Polynesia | 9 | 61 | 0 | ||
Norfolk Island | NF | NFK | 574 | ISO 3166-2:NF | Oceania | Australia and New Zealand | 9 | 53 | 0 | ||
Northern Mariana Islands | MP | MNP | 580 | ISO 3166-2:MP | Oceania | Micronesia | 9 | 57 | 0 | ||
Norway | NO | NOR | 578 | ISO 3166-2:NO | Europe | Northern Europe | 150 | 154 | 0 | ||
Oman | OM | OMN | 512 | ISO 3166-2:OM | Asia | Western Asia | 142 | 145 | 0 | ||
Pakistan | PK | PAK | 586 | ISO 3166-2:PK | Asia | Southern Asia | 142 | 34 | 0 | ||
Palau | PW | PLW | 585 | ISO 3166-2:PW | Oceania | Micronesia | 9 | 57 | 0 | ||
Palestine, State of | PS | PSE | 275 | ISO 3166-2:PS | Asia | Western Asia | 142 | 145 | 0 | ||
Panama | PA | PAN | 591 | ISO 3166-2:PA | Americas | Central America | 19 | 13 | 0 | ||
Papua New Guinea | PG | PNG | 598 | ISO 3166-2:PG | Oceania | Melanesia | 9 | 54 | 0 | ||
Paraguay | PY | PRY | 600 | ISO 3166-2:PY | Americas | South America | 19 | 5 | 0 | ||
Peru | PE | PER | 604 | ISO 3166-2:PE | Americas | South America | 19 | 5 | 0 | ||
Philippines | PH | PHL | 608 | ISO 3166-2:PH | Asia | South-Eastern Asia | 142 | 35 | 0 | ||
Pitcairn | PN | PCN | 612 | ISO 3166-2:PN | Oceania | Polynesia | 9 | 61 | 0 | ||
Poland | PL | POL | 616 | ISO 3166-2:PL | Europe | Eastern Europe | 150 | 151 | 0 | ||
Portugal | PT | PRT | 620 | ISO 3166-2:PT | Europe | Southern Europe | 150 | 39 | 0 | ||
Puerto Rico | PR | PRI | 630 | ISO 3166-2:PR | Americas | Caribbean | 19 | 29 | 0 | ||
Qatar | QA | QAT | 634 | ISO 3166-2:QA | Asia | Western Asia | 142 | 145 | 0 | ||
Reunion | RE | REU | 638 | ISO 3166-2:RE | Africa | Eastern Africa | 2 | 14 | 0 | ||
Romania | RO | ROU | 642 | ISO 3166-2:RO | Europe | Eastern Europe | 150 | 151 | 0 | ||
Russian Federation | RU | RUS | 643 | ISO 3166-2:RU | Europe | Eastern Europe | 150 | 151 | 0 | ||
Rwanda | RW | RWA | 646 | ISO 3166-2:RW | Africa | Eastern Africa | 2 | 14 | 0 | ||
Saint Barthelemy | BL | BLM | 652 | ISO 3166-2:BL | Americas | Caribbean | 19 | 29 | 0 | ||
Saint Helena, Ascension and Tristan da Cunha | SH | SHN | 654 | ISO 3166-2:SH | Africa | Western Africa | 2 | 11 | 0 | ||
Saint Kitts and Nevis | KN | KNA | 659 | ISO 3166-2:KN | Americas | Caribbean | 19 | 29 | 0 | ||
Saint Lucia | LC | LCA | 662 | ISO 3166-2:LC | Americas | Caribbean | 19 | 29 | 0 | ||
Saint Martin (French part) | MF | MAF | 663 | ISO 3166-2:MF | Americas | Caribbean | 19 | 29 | 0 | ||
Saint Pierre and Miquelon | PM | SPM | 666 | ISO 3166-2:PM | Americas | Northern America | 19 | 21 | 0 | ||
Saint Vincent and the Grenadines | VC | VCT | 670 | ISO 3166-2:VC | Americas | Caribbean | 19 | 29 | 0 | ||
Samoa | WS | WSM | 882 | ISO 3166-2:WS | Oceania | Polynesia | 9 | 61 | 0 | ||
San Marino | SM | SMR | 674 | ISO 3166-2:SM | Europe | Southern Europe | 150 | 39 | 0 | ||
Sao Tome and Principe | ST | STP | 678 | ISO 3166-2:ST | Africa | Middle Africa | 2 | 17 | 0 | ||
Saudi Arabia | SA | SAU | 682 | ISO 3166-2:SA | Asia | Western Asia | 142 | 145 | 0 | ||
Senegal | SN | SEN | 686 | ISO 3166-2:SN | Africa | Western Africa | 2 | 11 | 0 | ||
Serbia | RS | SRB | 688 | ISO 3166-2:RS | Europe | Southern Europe | 150 | 39 | 0 | ||
Seychelles | SC | SYC | 690 | ISO 3166-2:SC | Africa | Eastern Africa | 2 | 14 | 0 | ||
Sierra Leone | SL | SLE | 694 | ISO 3166-2:SL | Africa | Western Africa | 2 | 11 | 0 | ||
Singapore | SG | SGP | 702 | ISO 3166-2:SG | Asia | South-Eastern Asia | 142 | 35 | 0 | ||
Sint Maarten (Dutch part) | SX | SXM | 534 | ISO 3166-2:SX | Americas | Caribbean | 19 | 29 | 0 | ||
Slovakia | SK | SVK | 703 | ISO 3166-2:SK | Europe | Eastern Europe | 150 | 151 | 0 | ||
Slovenia | SI | SVN | 705 | ISO 3166-2:SI | Europe | Southern Europe | 150 | 39 | 0 | ||
Solomon Islands | SB | SLB | 90 | ISO 3166-2:SB | Oceania | Melanesia | 9 | 54 | 0 | ||
Somalia | SO | SOM | 706 | ISO 3166-2:SO | Africa | Eastern Africa | 2 | 14 | 0 | ||
South Africa | ZA | ZAF | 710 | ISO 3166-2:ZA | Africa | Southern Africa | 2 | 18 | 0 | ||
South Georgia and the South Sandwich Islands | GS | SGS | 239 | ISO 3166-2:GS | 0 | ||||||
South Sudan | SS | SSD | 728 | ISO 3166-2:SS | Africa | Eastern Africa | 2 | 14 | 0 | ||
Spain | ES | ESP | 724 | ISO 3166-2:ES | Europe | Southern Europe | 150 | 39 | 1 | ||
Sri Lanka | LK | LKA | 144 | ISO 3166-2:LK | Asia | Southern Asia | 142 | 34 | 0 | ||
Sudan | SD | SDN | 729 | ISO 3166-2:SD | Africa | Northern Africa | 2 | 15 | 0 | ||
Suriname | SR | SUR | 740 | ISO 3166-2:SR | Americas | South America | 19 | 5 | 0 | ||
Svalbard and Jan Mayen | SJ | SJM | 744 | ISO 3166-2:SJ | Europe | Northern Europe | 150 | 154 | 0 | ||
Swaziland | SZ | SWZ | 748 | ISO 3166-2:SZ | Africa | Southern Africa | 2 | 18 | 0 | ||
Sweden | SE | SWE | 752 | ISO 3166-2:SE | Europe | Northern Europe | 150 | 154 | 0 | ||
Switzerland | CH | CHE | 756 | ISO 3166-2:CH | Europe | Western Europe | 150 | 155 | 0 | ||
Syrian Arab Republic | SY | SYR | 760 | ISO 3166-2:SY | Asia | Western Asia | 142 | 145 | 0 | ||
Taiwan, Province of China | TW | TWN | 158 | ISO 3166-2:TW | Asia | Eastern Asia | 142 | 30 | 0 | ||
Tajikistan | TJ | TJK | 762 | ISO 3166-2:TJ | Asia | Central Asia | 142 | 143 | 0 | ||
Tanzania, United Republic of | TZ | TZA | 834 | ISO 3166-2:TZ | Africa | Eastern Africa | 2 | 14 | 0 | ||
Thailand | TH | THA | 764 | ISO 3166-2:TH | Asia | South-Eastern Asia | 142 | 35 | 0 | ||
Timor-Leste | TL | TLS | 626 | ISO 3166-2:TL | Asia | South-Eastern Asia | 142 | 35 | 0 | ||
Togo | TG | TGO | 768 | ISO 3166-2:TG | Africa | Western Africa | 2 | 11 | 0 | ||
Tokelau | TK | TKL | 772 | ISO 3166-2:TK | Oceania | Polynesia | 9 | 61 | 0 | ||
Tonga | TO | TON | 776 | ISO 3166-2:TO | Oceania | Polynesia | 9 | 61 | 0 | ||
Trinidad and Tobago | TT | TTO | 780 | ISO 3166-2:TT | Americas | Caribbean | 19 | 29 | 0 | ||
Tunisia | TN | TUN | 788 | ISO 3166-2:TN | Africa | Northern Africa | 2 | 15 | 0 | ||
Turkey | TR | TUR | 792 | ISO 3166-2:TR | Asia | Western Asia | 142 | 145 | 0 | ||
Turkmenistan | TM | TKM | 795 | ISO 3166-2:TM | Asia | Central Asia | 142 | 143 | 0 | ||
Turks and Caicos Islands | TC | TCA | 796 | ISO 3166-2:TC | Americas | Caribbean | 19 | 29 | 0 | ||
Tuvalu | TV | TUV | 798 | ISO 3166-2:TV | Oceania | Polynesia | 9 | 61 | 0 | ||
Uganda | UG | UGA | 800 | ISO 3166-2:UG | Africa | Eastern Africa | 2 | 14 | 0 | ||
Ukraine | UA | UKR | 804 | ISO 3166-2:UA | Europe | Eastern Europe | 150 | 151 | 0 | ||
United Arab Emirates | AE | ARE | 784 | ISO 3166-2:AE | Asia | Western Asia | 142 | 145 | 0 | ||
United Kingdom of Great Britain and Northern Ireland | GB | GBR | 826 | ISO 3166-2:GB | Europe | Northern Europe | 150 | 154 | 1 | ||
United States of America | US | USA | 840 | ISO 3166-2:US | Americas | Northern America | 19 | 21 | 1 | USATravels | |
United States Minor Outlying Islands | UM | UMI | 581 | ISO 3166-2:UM | 0 | ||||||
Uruguay | UY | URY | 858 | ISO 3166-2:UY | Americas | South America | 19 | 5 | 0 | ||
Uzbekistan | UZ | UZB | 860 | ISO 3166-2:UZ | Asia | Central Asia | 142 | 143 | 0 | ||
Vanuatu | VU | VUT | 548 | ISO 3166-2:VU | Oceania | Melanesia | 9 | 54 | 0 | ||
Venezuela (Bolivarian Republic of) | VE | VEN | 862 | ISO 3166-2:VE | Americas | South America | 19 | 5 | 0 | ||
Vietnam | VN | VNM | 704 | ISO 3166-2:VN | Asia | South-Eastern Asia | 142 | 35 | 1 | ||
Virgin Islands (British) | VG | VGB | 92 | ISO 3166-2:VG | Americas | Caribbean | 19 | 29 | 0 | ||
Virgin Islands (U.S.) | VI | VIR | 850 | ISO 3166-2:VI | Americas | Caribbean | 19 | 29 | 0 | ||
Wallis and Futuna | WF | WLF | 876 | ISO 3166-2:WF | Oceania | Polynesia | 9 | 61 | 0 | ||
Western Sahara | EH | ESH | 732 | ISO 3166-2:EH | Africa | Northern Africa | 2 | 15 | 0 | ||
Yemen | YE | YEM | 887 | ISO 3166-2:YE | Asia | Western Asia | 142 | 145 | 0 | ||
Zambia | ZM | ZMB | 894 | ISO 3166-2:ZM | Africa | Eastern Africa | 2 | 14 | 0 | ||
Zimbabwe | ZW | ZWE | 716 | ISO 3166-2:ZW | Africa | Eastern Africa | 2 | 14 | 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment