Skip to content

Commit

Permalink
globe speed change & update country list
Browse files Browse the repository at this point in the history
  • Loading branch information
harshcrop committed Dec 27, 2023
1 parent b506f02 commit 0832971
Show file tree
Hide file tree
Showing 6 changed files with 4,526 additions and 111 deletions.
60 changes: 58 additions & 2 deletions assets/data/connections.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,58 @@
data.connections = {"Colombia":["Ecuador","Cuba","Mexico","Peru","Venezuela, RB","Guyana","United States"],"South Sudan":["Nigeria","Sudan","Kenya","Uganda","Zambia","Malawi","Ethiopia","Somalia","Madagascar","Yemen, Rep."],"India":["Pakistan","Kazakhstan","Maldives","Sri Lanka","Vietnam","Thailand"],"Thailand":["Singapore","Indonesia","Nepal","Vietnam","Sri Lanka","Cambodia","Pakistan"],"Panama":["Cuba","Mexico","Ecuador","Colombia","Peru","Venezuela, RB","United States"],"Fiji":["Tuvalu","Nauru","Kiribati","Tonga","New Caledonia","New Zealand"]}
data.connections = getCountries(data.connections, data.countries)
data.connections = {
Colombia: [
"Ecuador",
"Cuba",
// "Mexico",
"Peru",
"Venezuela, RB",
"Guyana",
"United States",
],
"South Sudan": [
"Nigeria",
"Sudan",
"Kenya",
"Uganda",
"Zambia",
"Malawi",
"Ethiopia",
"Somalia",
"Madagascar",
"Yemen, Rep.",
],
India: [
"Pakistan",
"Kazakhstan",
"Maldives",
"Sri Lanka",
"Vietnam",
"Thailand",
],
Thailand: [
"Singapore",
"Indonesia",
"Nepal",
"Vietnam",
"Sri Lanka",
"Cambodia",
"Pakistan",
],
Panama: [
"Cuba",
// "Mexico",
"Ecuador",
"Colombia",
"Peru",
"Venezuela, RB",
"United States",
],
Fiji: [
"Tuvalu",
"Nauru",
"Kiribati",
"Tonga",
"New Caledonia",
"New Zealand",
],
};
data.connections = getCountries(data.connections, data.countries);
4,259 changes: 4,258 additions & 1 deletion assets/data/countries.all.json

Large diffs are not rendered by default.

67 changes: 66 additions & 1 deletion assets/data/countries.js
Original file line number Diff line number Diff line change
@@ -1 +1,66 @@
data.countries = [{"name":"Pakistan","latitude":"30.5167","longitude":"72.8"},{"name":"India","latitude":"28.6353","longitude":"77.225"},{"name":"Nepal","latitude":"27.6939","longitude":"85.3157"},{"name":"Kazakhstan","latitude":"51.1879","longitude":"71.4382"},{"name":"Maldives","latitude":"4.1742","longitude":"73.5109"},{"name":"Sri Lanka","latitude":"6.92148","longitude":"79.8528"},{"name":"Mongolia","latitude":"47.9129","longitude":"106.937"},{"name":"Thailand","latitude":"13.7308","longitude":"100.521"},{"name":"Lao PDR","latitude":"18.5826","longitude":"102.177"},{"name":"Cambodia","latitude":"11.5556","longitude":"104.874"},{"name":"Vietnam","latitude":"21.0069","longitude":"105.825"},{"name":"Singapore","latitude":"1.28941","longitude":"103.85"},{"name":"Indonesia","latitude":"-6.19752","longitude":"106.83"},{"name":"Chad","latitude":"12.1048","longitude":"15.0445"},{"name":"Nigeria","latitude":"9.05804","longitude":"7.48906"},{"name":"Namibia","latitude":"-22.5648","longitude":"17.0931"},{"name":"Zambia","latitude":"-15.3982","longitude":"28.2937"},{"name":"South Sudan","latitude":"4.85","longitude":"31.6"},{"name":"Somalia","latitude":"2.07515","longitude":"45.3254"},{"name":"Uganda","latitude":"0.314269","longitude":"32.5729"},{"name":"Kenya","latitude":"-1.27975","longitude":"36.8126"},{"name":"Malawi","latitude":"-13.9899","longitude":"33.7703"},{"name":"Comoros","latitude":"-11.6986","longitude":"43.2418"},{"name":"Madagascar","latitude":"-20.4667","longitude":"45.7167"},{"name":"Ethiopia","latitude":"9.02274","longitude":"38.7468"},{"name":"Yemen, Rep.","latitude":"15.352","longitude":"44.2075"},{"name":"Sudan","latitude":"15.5932","longitude":"32.5363"},{"name":"Norway","latitude":"59.9138","longitude":"10.7387"},{"name":"Greece","latitude":"37.9792","longitude":"23.7166"},{"name":"Serbia","latitude":"44.8024","longitude":"20.4656"},{"name":"Croatia","latitude":"45.8069","longitude":"15.9614"},{"name":"Spain","latitude":"40.4167","longitude":"-3.70327"},{"name":"Portugal","latitude":"38.7072","longitude":"-9.13552"},{"name":"Germany","latitude":"52.5235","longitude":"13.4115"},{"name":"Italy","latitude":"41.8955","longitude":"12.4823"},{"name":"Ukraine","latitude":"50.4536","longitude":"30.5038"},{"name":"Denmark","latitude":"55.6763","longitude":"12.5681"},{"name":"Romania","latitude":"44.4479","longitude":"26.0979"},{"name":"Mexico","latitude":"19.427","longitude":"-99.1276"},{"name":"United States","latitude":"38.8895","longitude":"-77.032"},{"name":"Greenland","latitude":"64.1836","longitude":"-51.7214"},{"name":"Iceland","latitude":"64.1353","longitude":"-21.8952"},{"name":"Ecuador","latitude":"-0.229498","longitude":"-78.5243"},{"name":"Colombia","latitude":"4.60987","longitude":"-74.082"},{"name":"Paraguay","latitude":"-25.3005","longitude":"-57.6362"},{"name":"Uruguay","latitude":"-34.8941","longitude":"-56.0675"},{"name":"Guyana","latitude":"6.80461","longitude":"-58.1548"},{"name":"Venezuela, RB","latitude":"9.08165","longitude":"-69.8371"},{"name":"Peru","latitude":"-12.0931","longitude":"-77.0465"},{"name":"Panama","latitude":"8.99427","longitude":"-79.5188"},{"name":"Cuba","latitude":"23.1333","longitude":"-82.3667"},{"name":"New Caledonia","latitude":"-22.2677","longitude":"166.464"},{"name":"New Zealand","latitude":"-41.2865","longitude":"174.776"},{"name":"Tonga","latitude":"-21.136","longitude":"-175.216"},{"name":"Fiji","latitude":"-18.1149","longitude":"178.399"},{"name":"Nauru","latitude":"-0.5477","longitude":"166.920867"},{"name":"Solomon Islands","latitude":"-9.42676","longitude":"159.949"},{"name":"Kiribati","latitude":"1.32905","longitude":"172.979"},{"name":"Tuvalu","latitude":"-8.6314877","longitude":"179.089567"}]
data.countries = [
{ name: "New York", latitude: "40.653015", longitude: "-73.984933" },
{ name: "Ashbern", latitude: "39.040465", longitude: "-77.471290" },
{ name: "Phoenix", latitude: "33.472770", longitude: "-112.092152" },
{ name: "Amsterdam", latitude: "52.356210", longitude: "4.866876" },
{ name: "Lithunia", latitude: "55.291551", longitude: "23.902315" },
{ name: "Pakistan", latitude: "30.5167", longitude: "72.8" },
{ name: "India", latitude: "28.6353", longitude: "77.225" },
{ name: "Nepal", latitude: "27.6939", longitude: "85.3157" },
{ name: "Kazakhstan", latitude: "51.1879", longitude: "71.4382" },
{ name: "Maldives", latitude: "4.1742", longitude: "73.5109" },
{ name: "Sri Lanka", latitude: "6.92148", longitude: "79.8528" },
{ name: "Mongolia", latitude: "47.9129", longitude: "106.937" },
{ name: "Thailand", latitude: "13.7308", longitude: "100.521" },
{ name: "Lao PDR", latitude: "18.5826", longitude: "102.177" },
{ name: "Cambodia", latitude: "11.5556", longitude: "104.874" },
{ name: "Vietnam", latitude: "21.0069", longitude: "105.825" },
{ name: "Singapore", latitude: "1.28941", longitude: "103.85" },
{ name: "Indonesia", latitude: "-6.19752", longitude: "106.83" },
{ name: "Chad", latitude: "12.1048", longitude: "15.0445" },
{ name: "Nigeria", latitude: "9.05804", longitude: "7.48906" },
{ name: "Namibia", latitude: "-22.5648", longitude: "17.0931" },
{ name: "Zambia", latitude: "-15.3982", longitude: "28.2937" },
{ name: "South Sudan", latitude: "4.85", longitude: "31.6" },
{ name: "Somalia", latitude: "2.07515", longitude: "45.3254" },
{ name: "Uganda", latitude: "0.314269", longitude: "32.5729" },
{ name: "Kenya", latitude: "-1.27975", longitude: "36.8126" },
{ name: "Malawi", latitude: "-13.9899", longitude: "33.7703" },
{ name: "Comoros", latitude: "-11.6986", longitude: "43.2418" },
{ name: "Madagascar", latitude: "-20.4667", longitude: "45.7167" },
{ name: "Ethiopia", latitude: "9.02274", longitude: "38.7468" },
{ name: "Yemen, Rep.", latitude: "15.352", longitude: "44.2075" },
{ name: "Sudan", latitude: "15.5932", longitude: "32.5363" },
{ name: "Norway", latitude: "59.9138", longitude: "10.7387" },
{ name: "Greece", latitude: "37.9792", longitude: "23.7166" },
{ name: "Serbia", latitude: "44.8024", longitude: "20.4656" },
{ name: "Croatia", latitude: "45.8069", longitude: "15.9614" },
{ name: "Spain", latitude: "40.4167", longitude: "-3.70327" },
{ name: "Portugal", latitude: "38.7072", longitude: "-9.13552" },
{ name: "Germany", latitude: "52.5235", longitude: "13.4115" },
{ name: "Italy", latitude: "41.8955", longitude: "12.4823" },
{ name: "Ukraine", latitude: "50.4536", longitude: "30.5038" },
{ name: "Denmark", latitude: "55.6763", longitude: "12.5681" },
{ name: "Romania", latitude: "44.4479", longitude: "26.0979" },
// { name: "Mexico", latitude: "19.427", longitude: "-99.1276" },
{ name: "United States", latitude: "38.8895", longitude: "-77.032" },
{ name: "Greenland", latitude: "64.1836", longitude: "-51.7214" },
{ name: "Iceland", latitude: "64.1353", longitude: "-21.8952" },
{ name: "Ecuador", latitude: "-0.229498", longitude: "-78.5243" },
{ name: "Colombia", latitude: "4.60987", longitude: "-74.082" },
{ name: "Paraguay", latitude: "-25.3005", longitude: "-57.6362" },
{ name: "Uruguay", latitude: "-34.8941", longitude: "-56.0675" },
{ name: "Guyana", latitude: "6.80461", longitude: "-58.1548" },
{ name: "Venezuela, RB", latitude: "9.08165", longitude: "-69.8371" },
{ name: "Peru", latitude: "-12.0931", longitude: "-77.0465" },
{ name: "Panama", latitude: "8.99427", longitude: "-79.5188" },
{ name: "Cuba", latitude: "23.1333", longitude: "-82.3667" },
{ name: "New Caledonia", latitude: "-22.2677", longitude: "166.464" },
{ name: "New Zealand", latitude: "-41.2865", longitude: "174.776" },
{ name: "Tonga", latitude: "-21.136", longitude: "-175.216" },
{ name: "Fiji", latitude: "-18.1149", longitude: "178.399" },
{ name: "Nauru", latitude: "-0.5477", longitude: "166.920867" },
{ name: "Solomon Islands", latitude: "-9.42676", longitude: "159.949" },
{ name: "Kiribati", latitude: "1.32905", longitude: "172.979" },
{ name: "Tuvalu", latitude: "-8.6314877", longitude: "179.089567" },
];
213 changes: 125 additions & 88 deletions assets/data/processing.js
Original file line number Diff line number Diff line change
@@ -1,124 +1,161 @@
// Select countries

const SouthAmerica = [
'Ecuador',
'Colombia',
'Paraguay',
'Uruguay',
'Guyana',
'Venezuela, RB',
'Peru',
'Panama',
'Cuba'
"Ecuador",
"Colombia",
"Paraguay",
"Uruguay",
"Guyana",
"Venezuela, RB",
"Peru",
"Panama",
"Cuba",
];

const NorthAmerica = [
'Mexico',
'United States',
'Greenland',
'Iceland'
]
const NorthAmerica = ["Mexico", "United States", "Greenland", "Iceland"];

const Europe = [
'Norway',
'Greece',
'Serbia',
'Croatia',
'Spain',
'Portugal',
'Germany',
'Italy',
'Ukraine',
'Denmark',
'Romania'
]
"Norway",
"Greece",
"Serbia",
"Croatia",
"Spain",
"Portugal",
"Germany",
"Italy",
"Ukraine",
"Denmark",
"Romania",
];

const Africa = [
'Chad',
'Nigeria',
'Namibia',
'Zambia',
'South Sudan',
'Somalia',
'Uganda',
'Kenya',
'Malawi',
'Comoros',
'Madagascar',
'Ethiopia',
'Yemen, Rep.',
'Sudan'
"Chad",
"Nigeria",
"Namibia",
"Zambia",
"South Sudan",
"Somalia",
"Uganda",
"Kenya",
"Malawi",
"Comoros",
"Madagascar",
"Ethiopia",
"Yemen, Rep.",
"Sudan",
];

const Asia = [
'Pakistan',
'India',
'Nepal',
'Kazakhstan',
'Maldives',
'Sri Lanka',
'Mongolia',
'Thailand',
'Lao PDR',
'Cambodia',
'Vietnam',
'Singapore',
'Indonesia'
]
"Pakistan",
"India",
"Nepal",
"Kazakhstan",
"Maldives",
"Sri Lanka",
"Mongolia",
"Thailand",
"Lao PDR",
"Cambodia",
"Vietnam",
"Singapore",
"Indonesia",
];

const Rest = [
'New Caledonia',
'New Zealand',
'Tonga',
'Fiji',
'Nauru',
'Solomon Islands',
'Kiribati',
'Tuvalu'
]
"New Caledonia",
"New Zealand",
"Tonga",
"Fiji",
"Nauru",
"Solomon Islands",
"Kiribati",
"Tuvalu",
];

const selected = [
...Asia,
...Africa,
...Europe,
...NorthAmerica,
...SouthAmerica,
...Rest
]

...Rest,
];

function selectCountries(list, countries) {
return list.map(name => {
const country = countries.find(c => c.name === name);
const {latitude, longitude} = country;
return {name, latitude, longitude};
})
return list.map((name) => {
const country = countries.find((c) => c.name === name);
const { latitude, longitude } = country;
return { name, latitude, longitude };
});
}




// Connections

const connections = {
'Colombia': ['Ecuador', 'Cuba', 'Mexico', 'Peru', 'Venezuela, RB', 'Guyana', 'United States'],
'South Sudan': ['Nigeria', 'Sudan', 'Kenya', 'Uganda', 'Zambia', 'Malawi', 'Ethiopia', 'Somalia', 'Madagascar', 'Yemen, Rep.'],
'India': ['Pakistan', 'Kazakhstan', 'Maldives', 'Sri Lanka', 'Vietnam', 'Thailand'],
'Thailand': ['Singapore', 'Indonesia', 'Nepal', 'Vietnam', 'Sri Lanka', 'Cambodia', 'Pakistan'],
'Panama': ['Cuba', 'Mexico', 'Ecuador', 'Colombia', 'Peru', 'Venezuela, RB', 'United States'],
'Fiji': ['Tuvalu', 'Nauru', 'Kiribati', 'Tonga', 'New Caledonia', 'New Zealand']
}

Colombia: [
"Ecuador",
"Cuba",
// "Mexico",
"Peru",
"Venezuela, RB",
"Guyana",
"United States",
],
"South Sudan": [
"Nigeria",
"Sudan",
"Kenya",
"Uganda",
"Zambia",
"Malawi",
"Ethiopia",
"Somalia",
"Madagascar",
"Yemen, Rep.",
],
India: [
"Pakistan",
"Kazakhstan",
"Maldives",
"Sri Lanka",
"Vietnam",
"Thailand",
],
Thailand: [
"Singapore",
"Indonesia",
"Nepal",
"Vietnam",
"Sri Lanka",
"Cambodia",
"Pakistan",
],
Panama: [
"Cuba",
"Mexico",
"Ecuador",
"Colombia",
"Peru",
"Venezuela, RB",
"United States",
],
Fiji: [
"Tuvalu",
"Nauru",
"Kiribati",
"Tonga",
"New Caledonia",
"New Zealand",
],
};

function getCountry(name, countries) {
return countries.find(c => c.name === name);
return countries.find((c) => c.name === name);
}

function getCountries(object, countries) {
return Object.keys(object).reduce((r, e) => {
r[e] = object[e].map(c => getCountry(c, countries))
r[e] = object[e].map((c) => getCountry(c, countries));
return r;
}, {})
}, {});
}


Loading

0 comments on commit 0832971

Please sign in to comment.