Here is my attempt at answering the question "2 cities outside Egypt, the great circle path between which separates Alexandria from Cairo", which was posed by the "Wolfram|Alpha Can't" Twitter account. To constrain the problem, I limited the possible cities to just capitals, as given in one specific list on Wikipedia. Apologies that some of the names have got slightly mangled. The columns of numbers in my table of results are as follows: Alex_dist and Cairo_dist are the distances of Alexandria and Cairo from the plane which contains the centre of the Earth and the two named capitals. It is in units of Earth radii. One number is positive and one is negative beacuse Alexandria and Cairo have to be on opposite sides of that plane. Similarly, City1_dist and City2_dist are the distances of the two capitals from the plane which contains the centre of the Earth, Alexandria and Cairo. Again, one number is positive and one is negative. Within each pair, the cities have been ordered so that City 1 is the one to the South West and City 2 is the one to the North East, so City1_dist is always the negative value. Line_length is the length of the great circle line, in units of degrees round the Earth. Orthogonality is the angle between the two planes (one containing the centre of the Earth and the two named capitals, and the other containing the centre of the Earth, Alexandria and Cairo). An easy way to check these results is to use the "Ruler" tool in Google Earth to draw the great circle line. Note that I have assumed a spherical Earth, which is close to the truth but not perfect. The Matlab code which I used appears below. City 1.......................... City 2.......................... Alex_dist Cairo_dist City1_dist City2_dist Line_length Orthogonality 1 Bridgetown, Barbados............ - Abu Dhabi, United Arab Emirates. 0.001551 -0.014226 -0.555934 0.213963 105.449 34.064 2 Port of Spain, Trinidad and Toba - Abu Dhabi, United Arab Emirates. 0.009683 -0.006549 -0.575182 0.213963 108.290 35.188 3 Quito, Ecuador.................. - Abu Dhabi, United Arab Emirates. 0.013668 -0.002784 -0.558869 0.213963 128.395 35.741 4 St. George's, Grenada........... - Abu Dhabi, United Arab Emirates. 0.000474 -0.015241 -0.556042 0.213963 107.781 33.916 5 Abuja, Nigeria.................. - Baku, Azerbaijan................ 0.024886 -0.003153 -0.505555 0.313739 48.890 84.568 6 Abuja, Nigeria.................. - Beirut, Lebanon................. 0.015274 -0.012807 -0.505555 0.091879 35.760 85.506 7 Abuja, Nigeria.................. - Damascus, Syria................. 0.025619 -0.002417 -0.505555 0.095951 36.055 84.496 8 Abuja, Nigeria.................. - Stepanakert, Nagorno-Karabakh Re 0.016982 -0.011092 -0.505555 0.275354 46.517 85.339 9 Abuja, Nigeria.................. - Tokyo, Japan.................... 0.018726 -0.009341 -0.505555 0.994087 116.543 85.169 10 Abuja, Nigeria.................. - Ulaanbaatar, Mongolia........... 0.010948 -0.017148 -0.505555 0.855551 89.514 85.928 11 Abuja, Nigeria.................. - Yerevan, Armenia................ 0.002030 -0.026092 -0.505555 0.255648 45.256 86.798 12 Accra, Ghana.................... - Baku, Azerbaijan................ 0.003372 -0.024439 -0.610183 0.313739 56.695 80.889 13 Accra, Ghana.................... - Beijing, China.................. 0.016879 -0.010853 -0.610183 0.912400 106.233 79.905 14 Accra, Ghana.................... - Beirut, Lebanon................. 0.007216 -0.020574 -0.610183 0.091879 43.548 80.609 15 Accra, Ghana.................... - Damascus, Syria................. 0.017508 -0.010220 -0.610183 0.095951 43.900 79.859 16 Accra, Ghana.................... - Seoul, South Korea.............. 0.000162 -0.027665 -0.610183 0.960914 114.687 81.124 17 Accra, Ghana.................... - Tarawa Atoll, Kiribati.......... 0.003974 -0.023833 -0.610183 0.732700 170.259 80.845 18 Addis Ababa, Ethiopia........... - Copenhagen, Denmark............. 0.003016 -0.008034 -0.154767 0.182706 50.993 23.097 19 Algiers, Algeria................ - Canberra, Australia............. 0.006664 -0.004237 -0.155272 0.301251 152.539 22.768 20 Algiers, Algeria................ - West Island, Cocos (Keeling) Isl 0.009601 -0.001119 -0.155272 0.369353 100.118 22.370 21 Asunción, Paraguay............. - Amman, Jordan................... 0.021042 -0.005152 -0.911860 0.073938 105.878 68.426 22 Bamako, Mali.................... - Amman, Jordan................... 0.013538 -0.011689 -0.573984 0.073938 44.593 63.588 23 Banjul, Gambia.................. - Amman, Jordan................... 0.002831 -0.020733 -0.604047 0.073938 51.291 56.784 24 Bissau, Guinea-Bissau........... - Amman, Jordan................... 0.006626 -0.017566 -0.621263 0.073938 51.272 59.187 25 Brasília, Brazil............... - Amman, Jordan................... 0.015512 -0.009986 -0.904924 0.073938 93.214 64.853 26 Conakry, Guinea................. - Amman, Jordan................... 0.012569 -0.012522 -0.643187 0.073938 50.987 62.968 27 Freetown, Sierra Leone.......... - Amman, Jordan................... 0.014796 -0.010605 -0.653938 0.073938 51.185 64.394 28 Monrovia, Liberia............... - Amman, Jordan................... 0.021108 -0.005093 -0.668361 0.073938 50.489 68.470 29 Niamey, Niger................... - Amman, Jordan................... 0.025177 -0.001475 -0.494627 0.073938 35.996 71.134 30 Ouagadougou, Burkina Faso....... - Amman, Jordan................... 0.022312 -0.004028 -0.536550 0.073938 39.547 69.254 31 Santiago, Chile................. - Amman, Jordan................... 0.025475 -0.001208 -0.857749 0.073938 119.600 71.330 32 Sucre, Bolivia.................. - Amman, Jordan................... 0.006679 -0.017521 -0.832800 0.073938 109.164 59.221 33 Hargeisa, Somaliland............ - Amsterdam, Netherlands.......... 0.003752 -0.001640 -0.078506 0.092894 53.242 11.036 34 Windhoek, Namibia............... - Ankara, Turkey.................. 0.000056 -0.024180 -0.706214 0.135389 64.210 59.370 35 Monrovia, Liberia............... - Ashgabat, Turkmenistan.......... 0.003494 -0.022882 -0.668361 0.383753 69.733 69.458 36 Niamey, Niger................... - Ashgabat, Turkmenistan.......... 0.020288 -0.006438 -0.494627 0.383753 55.274 71.597 37 Ouagadougou, Burkina Faso....... - Ashgabat, Turkmenistan.......... 0.009949 -0.016567 -0.536550 0.383753 58.807 70.279 38 Santiago, Chile................. - Ashgabat, Turkmenistan.......... 0.016267 -0.010380 -0.857749 0.383753 138.877 71.084 39 Asmara, Eritrea................. - Prague, Czech Republic.......... 0.007642 -0.000484 -0.081560 0.115490 40.017 16.769 40 Asmara, Eritrea................. - Pristina, [g]................... 0.001586 -0.006030 -0.081560 0.064212 31.292 15.688 41 Asmara, Eritrea................. - Reykjavík, Iceland............. 0.003944 -0.003871 -0.081560 0.201668 63.719 16.108 42 Asmara, Eritrea................. - Vienna, Austria................. 0.006382 -0.001638 -0.081560 0.102522 37.747 16.544 43 Malabo, Equatorial Guinea....... - Astana, Kazakhstan.............. 0.026394 -0.001741 -0.555752 0.593050 70.224 87.334 44 N'Djamena, Chad................. - Astana, Kazakhstan.............. 0.026287 -0.001849 -0.396556 0.593050 59.809 87.342 45 Asunción, Paraguay............. - Jerusalem, Israel............... 0.020052 -0.006140 -0.911860 0.064133 105.250 68.415 46 Asunción, Paraguay............. - Tehran, Iran.................... 0.019913 -0.006279 -0.911860 0.286908 119.264 68.413 47 Bamako, Mali.................... - Baghdad, Iraq................... 0.017385 -0.007784 -0.573984 0.184370 51.876 63.322 48 Bissau, Guinea-Bissau........... - Baghdad, Iraq................... 0.002389 -0.021860 -0.621263 0.184370 58.555 59.420 49 Brasília, Brazil............... - Baghdad, Iraq................... 0.023203 -0.002292 -0.904924 0.184370 100.489 64.843 50 Conakry, Guinea................. - Baghdad, Iraq................... 0.015424 -0.009631 -0.643187 0.184370 58.272 62.811 51 Freetown, Sierra Leone.......... - Baghdad, Iraq................... 0.020329 -0.005007 -0.653938 0.184370 58.464 64.091 52 Sucre, Bolivia.................. - Baghdad, Iraq................... 0.001325 -0.022854 -0.832800 0.184370 116.446 59.144 53 Lomé, Togo..................... - Baku, Azerbaijan................ 0.007451 -0.020413 -0.592584 0.313739 55.291 81.586 54 Porto-Novo, Benin............... - Baku, Azerbaijan................ 0.012465 -0.015458 -0.577418 0.313739 54.076 82.442 55 Bamako, Mali.................... - Islamabad, Pakistan............. 0.024849 -0.000203 -0.573984 0.516224 75.665 62.807 56 Bamako, Mali.................... - Jerusalem, Israel............... 0.013500 -0.011728 -0.573984 0.064133 43.962 63.591 57 Bamako, Mali.................... - Kabul, Afghanistan.............. 0.018481 -0.006671 -0.573984 0.478218 72.382 63.246 58 Bangui, Central African Republic - Episkopi Cantonment, Akrotiri an 0.012122 -0.014363 -0.450307 0.072890 33.060 70.100 59 Bangui, Central African Republic - Nicosia, Cyprus................. 0.014425 -0.012101 -0.450307 0.084220 33.698 70.340 60 Banjul, Gambia.................. - Hanoi, Vietnam.................. 0.000244 -0.023358 -0.604047 0.775105 113.788 56.927 61 Banjul, Gambia.................. - Jerusalem, Israel............... 0.004011 -0.019536 -0.604047 0.064133 50.665 56.720 62 Banjul, Gambia.................. - Kathmandu, Nepal................ 0.010961 -0.012484 -0.604047 0.613259 93.989 56.339 63 Basseterre, Saint Kitts and Nevi - Flying Fish Cove, Christmas Isla 0.012311 -0.001268 -0.479939 0.477634 166.820 28.821 64 Basseterre, Saint Kitts and Nevi - Sri Jayawardenepura Kotte, Sri L 0.009421 -0.004164 -0.479939 0.377665 135.840 28.837 65 Georgetown, Ascension Island.... - Beijing, China.................. 0.010315 -0.017403 -0.832604 0.912400 125.791 79.753 66 Lomé, Togo..................... - Beijing, China.................. 0.026473 -0.001276 -0.592584 0.912400 104.813 80.128 67 Buenos Aires, Argentina......... - Beirut, Lebanon................. 0.000098 -0.027267 -0.934611 0.091879 111.287 76.313 68 Georgetown, Ascension Island.... - Beirut, Lebanon................. 0.006054 -0.021677 -0.832604 0.091879 63.101 79.907 69 Jamestown, Saint Helena......... - Beirut, Lebanon................. 0.027237 -0.000892 -0.848294 0.091879 63.424 87.083 70 Lomé, Togo..................... - Beirut, Lebanon................. 0.008674 -0.019183 -0.592584 0.091879 42.142 81.492 71 Malabo, Equatorial Guinea....... - Beirut, Lebanon................. 0.026786 -0.001350 -0.555752 0.091879 39.080 87.367 72 Montevideo, Uruguay............. - Beirut, Lebanon................. 0.002017 -0.025478 -0.945444 0.091879 109.817 77.470 73 N'Djamena, Chad................. - Beirut, Lebanon................. 0.026732 -0.001404 -0.396556 0.091879 28.666 87.401 74 Porto-Novo, Benin............... - Beirut, Lebanon................. 0.010502 -0.017431 -0.577418 0.091879 40.926 82.600 75 São Tomé, São Tomé and Prín - Beirut, Lebanon................. 0.027564 -0.000559 -0.611895 0.091879 43.072 86.877 76 Buenos Aires, Argentina......... - Bishkek, Kyrgyzstan............. 0.000171 -0.027194 -0.934611 0.585431 142.914 76.314 77 Montevideo, Uruguay............. - Bishkek, Kyrgyzstan............. 0.018611 -0.008912 -0.945444 0.585431 141.434 77.716 78 Bissau, Guinea-Bissau........... - Jerusalem, Israel............... 0.007376 -0.016805 -0.621263 0.064133 50.643 59.146 79 Bissau, Guinea-Bissau........... - Manila, Philippines............. 0.022381 -0.001590 -0.621263 0.843944 129.474 58.327 80 Bissau, Guinea-Bissau........... - Ngerulmud, Palau................ 0.006060 -0.018139 -0.621263 0.850156 144.600 59.218 81 Bogotá, Colombia............... - Doha, Qatar..................... 0.003851 -0.011832 -0.548628 0.186491 119.375 33.832 82 Brasília, Brazil............... - Jerusalem, Israel............... 0.015227 -0.010272 -0.904924 0.064133 92.584 64.854 83 Brazzaville, Republic of the Con - Episkopi Cantonment, Akrotiri an 0.012404 -0.014045 -0.576104 0.072890 42.298 69.881 84 Brazzaville, Republic of the Con - Nicosia, Cyprus................. 0.014839 -0.011640 -0.576104 0.084220 42.936 70.059 85 Bridgetown, Barbados............ - Doha, Qatar..................... 0.005156 -0.010611 -0.555934 0.186491 102.758 34.039 86 Nairobi, Kenya.................. - Bucharest, Romania.............. 0.003114 -0.012011 -0.291334 0.128504 46.703 32.478 87 Buenos Aires, Argentina......... - Damascus, Syria................. 0.011556 -0.015833 -0.934611 0.095951 111.683 76.500 88 Bujumbura, Burundi.............. - Kiev, Ukraine................... 0.000824 -0.019414 -0.407397 0.237490 53.842 45.932 89 Cayenne, French Guiana.......... - Kuwait City, Kuwait............. 0.008613 -0.011238 -0.696671 0.184554 96.502 44.809 90 Charlotte Amalie, United States - Riyadh, Saudi Arabia............ 0.007576 -0.005151 -0.450427 0.119577 100.797 26.862 91 Juba, South Sudan............... - Chisinau, Moldova............... 0.004000 -0.014695 -0.292395 0.183786 42.214 41.584 92 Kampala, Uganda................. - Chisinau, Moldova............... 0.008990 -0.009333 -0.329006 0.183786 46.796 40.577 93 Khartoum, Sudan................. - Chisinau, Moldova............... 0.016801 -0.000926 -0.157916 0.183786 31.511 39.003 94 Lilongwe, Malawi................ - Chisinau, Moldova............... 0.010716 -0.007476 -0.453532 0.183786 61.139 40.229 95 Maputo, Mozambique.............. - Chisinau, Moldova............... 0.001453 -0.017430 -0.563094 0.183786 73.042 42.099 96 Cockburn Town, Turks and Caicos - Malé, Maldives................. 0.008983 -0.001184 -0.360918 0.266988 136.922 21.159 97 Conakry, Guinea................. - Islamabad, Pakistan............. 0.021002 -0.003983 -0.643187 0.516224 82.065 62.504 98 Conakry, Guinea................. - Jerusalem, Israel............... 0.012641 -0.012448 -0.643187 0.064133 50.357 62.964 99 Conakry, Guinea................. - Kabul, Afghanistan.............. 0.014289 -0.010781 -0.643187 0.478218 78.778 62.873 100 Dakar, Senegal.................. - Dhaka, Bangladesh............... 0.019637 -0.003091 -0.590528 0.641824 99.730 53.798 101 Dakar, Senegal.................. - Jerusalem, Israel............... 0.001336 -0.021678 -0.590528 0.064133 50.781 54.794 102 Dakar, Senegal.................. - New Delhi, India................ 0.006994 -0.015933 -0.590528 0.528384 86.988 54.485 103 Georgetown, Ascension Island.... - Damascus, Syria................. 0.016901 -0.010797 -0.832604 0.095951 63.459 79.515 104 Lomé, Togo..................... - Damascus, Syria................. 0.018991 -0.008806 -0.592584 0.095951 42.484 80.701 105 Montevideo, Uruguay............. - Damascus, Syria................. 0.013583 -0.013932 -0.945444 0.095951 110.199 77.641 106 Niamey, Niger................... - Damascus, Syria................. 0.005341 -0.021597 -0.494627 0.095951 36.901 73.017 107 Ouagadougou, Burkina Faso....... - Damascus, Syria................. 0.001673 -0.024953 -0.536550 0.095951 40.407 70.967 108 Porto-Novo, Benin............... - Damascus, Syria................. 0.020866 -0.007011 -0.577418 0.095951 41.256 81.769 109 Santiago, Chile................. - Damascus, Syria................. 0.001168 -0.025412 -0.857749 0.095951 120.481 70.685 110 Yamoussoukro, Ivory Coast....... - Damascus, Syria................. 0.006701 -0.020345 -0.630459 0.095951 46.776 73.777 111 Djibouti, Djibouti.............. - Ljubljana, Slovenia............. 0.001434 -0.003583 -0.068609 0.059465 42.158 10.260 112 Djibouti, Djibouti.............. - Podgorica, Montenegro........... 0.002017 -0.003038 -0.068609 0.045597 37.194 10.339 113 Dodoma, Tanzania................ - Riga, Latvia.................... 0.011823 -0.004851 -0.355084 0.268541 63.835 36.297 114 Dodoma, Tanzania................ - Vilnius, Lithuania.............. 0.013748 -0.002983 -0.355084 0.248861 61.481 36.441 115 Kingstown, Saint Vincent and the - Doha, Qatar..................... 0.000025 -0.015407 -0.545125 0.186491 104.085 33.226 116 Port of Spain, Trinidad and Toba - Doha, Qatar..................... 0.012322 -0.003905 -0.575182 0.186491 105.595 35.179 117 Quito, Ecuador.................. - Doha, Qatar..................... 0.016110 -0.000359 -0.558869 0.186491 125.700 35.783 118 St. George's, Grenada........... - Doha, Qatar..................... 0.004268 -0.011442 -0.556042 0.186491 105.091 33.898 119 Tripoli, Libya.................. - Doha, Qatar..................... 0.001624 -0.013914 -0.137258 0.186491 34.167 33.479 120 Monrovia, Liberia............... - Dushanbe, Tajikistan............ 0.004514 -0.021851 -0.668361 0.501121 77.930 69.400 121 Niamey, Niger................... - Dushanbe, Tajikistan............ 0.024450 -0.002213 -0.494627 0.501121 63.462 71.203 122 Ouagadougou, Burkina Faso....... - Dushanbe, Tajikistan............ 0.012191 -0.014294 -0.536550 0.501121 67.001 70.093 123 Santiago, Chile................. - Dushanbe, Tajikistan............ 0.026014 -0.000671 -0.857749 0.501121 147.066 71.344 124 Edinburgh of the Seven Seas, Tri - Episkopi Cantonment, Akrotiri an 0.001863 -0.025692 -0.959825 0.072890 83.113 78.048 125 Edinburgh of the Seven Seas, Tri - Nicosia, Cyprus................. 0.002926 -0.024631 -0.959825 0.084220 83.766 78.060 126 Edinburgh of the Seven Seas, Tri - Sukhumi, Abkhazia............... 0.002177 -0.025379 -0.959825 0.249101 93.587 78.052 127 King Edward Point, South Georgia - Episkopi Cantonment, Akrotiri an 0.001741 -0.025824 -0.954583 0.072890 107.007 78.142 128 Kinshasa, Democratic Republic of - Episkopi Cantonment, Akrotiri an 0.012497 -0.013940 -0.576352 0.072890 42.340 69.808 129 Luanda, Angola.................. - Episkopi Cantonment, Akrotiri an 0.012047 -0.014448 -0.639791 0.072890 47.301 70.159 130 Windhoek, Namibia............... - Episkopi Cantonment, Akrotiri an 0.024372 -0.000105 -0.706214 0.072890 59.163 60.350 131 Rabat, Morocco.................. - Flying Fish Cove, Christmas Isla 0.011426 -0.002149 -0.256139 0.477634 114.412 28.814 132 Freetown, Sierra Leone.......... - Jerusalem, Israel............... 0.014612 -0.010791 -0.653938 0.064133 50.555 64.404 133 Freetown, Sierra Leone.......... - Kabul, Afghanistan.............. 0.025057 -0.000221 -0.653938 0.478218 78.967 63.833 134 Freetown, Sierra Leone.......... - Tehran, Iran.................... 0.000967 -0.024592 -0.653938 0.286908 64.539 65.154 135 Gibraltar, Gibraltar............ - Riyadh, Saudi Arabia............ 0.001664 -0.010548 -0.215448 0.119577 45.806 25.694 136 Ouagadougou, Burkina Faso....... - Hagåtña, Guam................. 0.014818 -0.011629 -0.536550 0.915232 137.755 69.875 137 Harare, Zimbabwe................ - Kiev, Ukraine................... 0.012036 -0.007566 -0.520050 0.237490 68.315 44.097 138 Harare, Zimbabwe................ - Tiraspol, Transnistria.......... 0.002682 -0.016752 -0.520050 0.188005 64.726 43.628 139 Hargeisa, Somaliland............ - Podgorica, Montenegro........... 0.000627 -0.004581 -0.078506 0.045597 39.400 10.656 140 Kampala, Uganda................. - Helsinki, Finland............... 0.000483 -0.017532 -0.329006 0.311978 60.150 39.763 141 Khartoum, Sudan................. - Helsinki, Finland............... 0.013843 -0.003652 -0.157916 0.311978 44.880 38.398 142 Lilongwe, Malawi................ - Helsinki, Finland............... 0.001220 -0.016766 -0.453532 0.311978 74.495 39.687 143 Tripoli, Libya.................. - Jakarta, Indonesia.............. 0.003975 -0.011345 -0.137258 0.538325 96.404 32.950 144 Jamestown, Saint Helena......... - Tbilisi, Georgia................ 0.013480 -0.014638 -0.848294 0.273628 74.099 86.594 145 Jamestown, Saint Helena......... - Tskhinvali, South Ossetia....... 0.001358 -0.026744 -0.848294 0.270508 73.964 86.164 146 Monrovia, Liberia............... - Jerusalem, Israel............... 0.020194 -0.006017 -0.668361 0.064133 49.862 68.521 147 Niamey, Niger................... - Jerusalem, Israel............... 0.023851 -0.002822 -0.494627 0.064133 35.371 71.259 148 Ouagadougou, Burkina Faso....... - Jerusalem, Israel............... 0.021292 -0.005064 -0.536550 0.064133 38.920 69.339 149 Santiago, Chile................. - Jerusalem, Israel............... 0.023888 -0.002789 -0.857749 0.064133 118.976 71.288 150 Sucre, Bolivia.................. - Jerusalem, Israel............... 0.007497 -0.016706 -0.832800 0.064133 108.535 59.233 151 Yamoussoukro, Ivory Coast....... - Jerusalem, Israel............... 0.025539 -0.001329 -0.630459 0.064133 45.225 72.538 152 Juba, South Sudan............... - Kiev, Ukraine................... 0.017686 -0.001586 -0.292395 0.237490 45.609 43.174 153 Juba, South Sudan............... - Minsk, Belarus.................. 0.000771 -0.017786 -0.292395 0.255449 49.160 41.211 154 Juba, South Sudan............... - Tiraspol, Transnistria.......... 0.009544 -0.009386 -0.292395 0.188005 42.034 42.227 155 Kampala, Uganda................. - Minsk, Belarus.................. 0.006895 -0.011352 -0.329006 0.255449 53.747 40.376 156 Kampala, Uganda................. - Tiraspol, Transnistria.......... 0.014863 -0.003669 -0.329006 0.188005 46.608 41.142 157 Khartoum, Sudan................. - Minsk, Belarus.................. 0.016884 -0.000849 -0.157916 0.255449 38.464 39.020 158 Khartoum, Sudan................. - Riga, Latvia.................... 0.006555 -0.010362 -0.157916 0.268541 41.806 36.911 159 Khartoum, Sudan................. - Tallinn, Estonia................ 0.012292 -0.005081 -0.157916 0.302230 44.177 38.081 160 Khartoum, Sudan................. - Vilnius, Lithuania.............. 0.007944 -0.009084 -0.157916 0.248861 39.453 37.194 161 Kigali, Rwanda.................. - Kiev, Ukraine................... 0.005684 -0.014280 -0.384144 0.237490 52.395 45.136 162 Mbabane, Swaziland.............. - Kiev, Ukraine................... 0.012281 -0.007306 -0.581851 0.237490 76.769 44.057 163 King Edward Point, South Georgia - Nicosia, Cyprus................. 0.002824 -0.024739 -0.954583 0.084220 107.660 78.128 164 King Edward Point, South Georgia - Sukhumi, Abkhazia............... 0.001763 -0.025802 -0.954583 0.249101 117.482 78.142 165 Kingston, Jamaica............... - Malé, Maldives................. 0.008484 -0.001671 -0.358874 0.266988 143.283 21.133 166 Kinshasa, Democratic Republic of - Nicosia, Cyprus................. 0.014946 -0.011521 -0.576352 0.084220 42.978 69.987 167 Libreville, Gabon............... - Tskhinvali, South Ossetia....... 0.019341 -0.008585 -0.586132 0.270508 52.075 82.502 168 Lilongwe, Malawi................ - Minsk, Belarus.................. 0.008790 -0.009361 -0.453532 0.255449 68.091 40.119 169 Lilongwe, Malawi................ - Tiraspol, Transnistria.......... 0.017443 -0.000892 -0.453532 0.188005 60.947 40.616 170 Lisbon, Portugal................ - Malé, Maldives................. 0.001321 -0.008668 -0.192217 0.266988 81.656 20.772 171 Lomé, Togo..................... - Pyongyang, North Korea.......... 0.002179 -0.025712 -0.592584 0.956445 111.744 81.990 172 Lomé, Togo..................... - Seoul, South Korea.............. 0.011455 -0.016387 -0.592584 0.960914 113.282 81.279 173 Lomé, Togo..................... - Stepanakert, Nagorno-Karabakh Re 0.000664 -0.027234 -0.592584 0.275354 52.885 82.107 174 Victoria, Seychelles............ - London, United Kingdom.......... 0.001117 -0.001919 -0.073109 0.054786 73.280 6.186 175 Luanda, Angola.................. - Nicosia, Cyprus................. 0.014472 -0.012048 -0.639791 0.084220 47.939 70.308 176 Malabo, Equatorial Guinea....... - Tbilisi, Georgia................ 0.014744 -0.013366 -0.555752 0.273628 49.754 86.339 177 Malabo, Equatorial Guinea....... - Tskhinvali, South Ossetia....... 0.004705 -0.023374 -0.555752 0.270508 49.627 85.482 178 Tunis, Tunisia.................. - Malé, Maldives................. 0.000518 -0.009453 -0.105455 0.266988 66.289 20.732 179 Valletta, Malta................. - Malé, Maldives................. 0.000483 -0.009486 -0.083982 0.266988 62.688 20.730 180 Port of Spain, Trinidad and Toba - Manama, Bahrain................. 0.001850 -0.014393 -0.575182 0.184084 104.473 35.218 181 Quito, Ecuador.................. - Manama, Bahrain................. 0.003974 -0.012414 -0.558869 0.184084 124.582 35.577 182 Maputo, Mozambique.............. - Tiraspol, Transnistria.......... 0.008826 -0.010158 -0.563094 0.188005 72.866 42.373 183 Marigot, Saint Martin........... - Riyadh, Saudi Arabia............ 0.013183 -0.000028 -0.467028 0.119577 99.404 27.975 184 Mbabane, Swaziland.............. - Tiraspol, Transnistria.......... 0.002374 -0.017083 -0.581851 0.188005 73.180 43.691 185 Mogadishu, Somalia.............. - Pristina, [g]................... 0.002256 -0.005285 -0.142422 0.064212 46.021 15.527 186 Mogadishu, Somalia.............. - Reykjavík, Iceland............. 0.006895 -0.000843 -0.142422 0.201668 78.446 15.947 187 Monrovia, Liberia............... - Tehran, Iran.................... 0.020452 -0.005757 -0.668361 0.286908 63.875 68.506 188 Moroni, Comoros................. - Oslo, Norway.................... 0.002315 -0.010173 -0.310764 0.233179 76.231 26.319 189 Nairobi, Kenya.................. - Stockholm, Sweden............... 0.001633 -0.013437 -0.291334 0.262553 62.377 32.348 190 Nouakchott, Mauritania.......... - Naypyidaw, Burma................ 0.003632 -0.018360 -0.537704 0.674986 103.348 51.334 191 N'Djamena, Chad................. - Tbilisi, Georgia................ 0.016305 -0.011795 -0.396556 0.273628 39.342 86.024 192 N'Djamena, Chad................. - Tskhinvali, South Ossetia....... 0.007651 -0.020404 -0.396556 0.270508 39.221 84.883 193 N'Djamena, Chad................. - Yerevan, Armenia................ 0.028016 -0.000124 -0.396556 0.255648 38.211 87.571 194 Niamey, Niger................... - Palikir, Federated States of Mic 0.000537 -0.026465 -0.494627 0.849706 148.646 73.474 195 Niamey, Niger................... - Saipan, Northern Mariana Islands 0.017771 -0.008993 -0.494627 0.927213 133.991 71.836 196 Nouakchott, Mauritania.......... - Port Moresby, Papua New Guinea.. 0.013182 -0.008633 -0.537704 0.686431 161.556 50.758 197 Ouagadougou, Burkina Faso....... - Tehran, Iran.................... 0.023983 -0.002333 -0.536550 0.286908 52.933 69.116 198 Yamoussoukro, Ivory Coast....... - Palikir, Federated States of Mic 0.020200 -0.006721 -0.630459 0.849706 158.518 72.888 199 Panama City, Panama............. - Riyadh, Saudi Arabia............ 0.009027 -0.003826 -0.445401 0.119577 117.751 27.150 200 Port Louis, Mauritius........... - Skopje, Macedonia............... 0.003932 -0.002941 -0.204377 0.057566 70.537 14.122 201 Porto-Novo, Benin............... - Pyongyang, North Korea.......... 0.015536 -0.012371 -0.577418 0.956445 110.530 82.196 202 Porto-Novo, Benin............... - Seoul, South Korea.............. 0.024696 -0.003158 -0.577418 0.960914 112.056 81.462 203 Porto-Novo, Benin............... - Stepanakert, Nagorno-Karabakh Re 0.005274 -0.022684 -0.577418 0.275354 51.678 83.019 204 Rabat, Morocco.................. - Sri Jayawardenepura Kotte, Sri L 0.010615 -0.002993 -0.256139 0.377665 83.431 28.891 205 Road Town, British Virgin Island - Riyadh, Saudi Arabia............ 0.008012 -0.004753 -0.451598 0.119577 100.488 26.949 206 San Juan, Puerto Rico........... - Riyadh, Saudi Arabia............ 0.004446 -0.008009 -0.441086 0.119577 101.655 26.243 207 The Valley, Anguilla............ - Riyadh, Saudi Arabia............ 0.012623 -0.000540 -0.465200 0.119577 99.306 27.863 208 São Tomé, São Tomé and Prín - Tbilisi, Georgia................ 0.016222 -0.011879 -0.611895 0.273628 53.752 86.041 209 São Tomé, São Tomé and Prín - Tskhinvali, South Ossetia....... 0.005750 -0.022321 -0.611895 0.270508 53.628 85.270 210 Stanley, Falkland Islands....... - Tbilisi, Georgia................ 0.012594 -0.015529 -0.921332 0.273628 128.568 86.772 211 Yamoussoukro, Ivory Coast....... - Tashkent, Uzbekistan............ 0.001368 -0.025724 -0.630459 0.522779 73.875 74.129 212 Yaoundé, Cameroon.............. - Tskhinvali, South Ossetia....... 0.018692 -0.009243 -0.528530 0.270508 48.032 82.634 213 Victoria, Seychelles............ - Vaduz, Liechtenstein............ 0.000790 -0.002236 -0.073109 0.041520 65.634 6.166 Some records: Most orthogonal intersection: N'Djamena, Chad - Yerevan, Armenia 87.571 degrees between the two planes but the great circle line passes only 0.000124 Earth radii (~790 m) from the nominal Cairo position. Least orthogonal intersection: Victoria, Seychelles - Vaduz, Liechtenstein 6.166 degrees between the two planes, narrowly beating Victoria - London, which is 6.186 degrees. Best at missing Cairo and Alexandria: Montevideo, Uruguay - Damascus, Syria 0.013583 Earth radii (~86.5 km) from Alexandria and 0.013932 Earth radii (~88.8 km) from Cairo Worst at missing Cairo and Alexandria: Kingstown, Saint Vincent and the Grenadines - Doha, Qatar 0.000025 Earth radii (~120 m) from the nominal Alexandria position. Shortest great circle line N'Djamena, Chad - Beirut, Lebanon The great circle is 28.666 degrees of the Earth's surface, which is about 3190 km. Longest great circle line Accra, Ghana - Tarawa Atoll, Kiribati The great circle is 170.259 degrees of the Earth's surface, which is about 18930 km. My personal favourite though is Dakar, Senegal - Dhaka, Bangladesh because they have similar names and are similar distances West and East of the Nile. A kml document (for use on Google Earth or similar applications) of the 213 lines is at http://www.benguin.co.uk/great_circle_results.kml A picture of the lines is at http://www.benguin.co.uk/great_circle_results.jpg Matlab code: bneedtoreadfromwiki = 0; %Don't bother pestering Wikipedia again once we have got the values we need if bneedtoreadfromwiki == 1 %Load the coordinates of all the capital cities from Wikipedia. %Unfortunately, they don't seem to all be on one page so we will have %to follow links to find them. indexpage = urlread('http://en.wikipedia.org/wiki/List_of_national_capitals_in_alphabetical_order'); pos1 = strfind(indexpage, sprintf('\n=11 && length(quotepos)>=2 cityname = citytext2(bracketpos(6)+1:bracketpos(7)-1); if bracketpos(end-3) == bracketpos(end-4) + 1 countryname = citytext2(bracketpos(end-6)+1:bracketpos(end-5)-1); else countryname = citytext2(bracketpos(end-4)+1:bracketpos(end-3)-1); end linktext = sprintf('http://en.wikipedia.org%s', citytext2(quotepos(1)+1:quotepos(2)-1)); citypage = urlread(linktext); pos3 = strfind(citypage, ''); if length(pos3) >= 1 coords = sscanf(citypage(pos3(1):min(pos3(1)+100,length(citypage))), '%f; %f'); end end end if length(coords) == 2 numcities = numcities + 1; citynames{numcities, 1} = cityname; citynames{numcities, 2} = countryname; citypos(numcities, :) = [coords(2) coords(1)]; fprintf('%s\t\t%s\t\t(%.3f, %.3f)\n', cityname, countryname, coords(2), coords(1)) else fprintf('\t\t\tXXXXX %s\n',citytext1(1:100)); %Show where there was a problem %return end end citypos = citypos(1:numcities, :); citynames = citynames(1:numcities, :); save world_capital_cities citynames citypos end %Load the pre-saved file of capital cities load world_capital_cities numcities0 = size(citypos, 1); %Prune the list of cities slightly bcityok = ones(numcities0, 1); for cityno = 1:numcities0 if length(strfind(citynames{cityno, 1}, 'Cairo')) > 0 bcityok(cityno) = 0; %We are specifically interested in cities outside Egypt. end if length(strfind(citynames{cityno, 2}, 'Northern Cyprus')) > 0 bcityok(cityno) = 0; %Nicosia appears twice in the list so get rid of one of them end end goodcitynos = find(bcityok == 1); citypos = citypos(goodcitynos, :); citynames = citynames(goodcitynos, :); numcities = length(goodcitynos); %Convert to cartesian coordinates cityxyz = zeros(numcities, 3); for cityno = 1:numcities longrads = citypos(cityno, 1) * pi/180; latrads = citypos(cityno, 2) * pi/180; cityxyz(cityno, :) = [cos(longrads)*cos(latrads) sin(longrads)*cos(latrads) sin(latrads)]; end longrads = 29.917 * pi/180; latrads = 31.200 * pi/180; A = [cos(longrads)*cos(latrads) sin(longrads)*cos(latrads) sin(latrads)]; %Alexandria longrads = 31.233 * pi/180; latrads = 30.050 * pi/180; C = [cos(longrads)*cos(latrads) sin(longrads)*cos(latrads) sin(latrads)]; %Cairo OACnormal0 = cross(A, C); OACnormal = OACnormal0 / sqrt(sum(OACnormal0.^2)); %A unit vector normal to the plane OAC maxnumpairs = numcities * (numcities-1) / 2; pairs = zeros(maxnumpairs, 8); numpairs = 0; for cityno1 = 1:numcities-1 for cityno2 = cityno1+1:numcities E = cityxyz(cityno1, :); F = cityxyz(cityno2, :); OEFnormal0 = cross(E, F); OEFnormal0length = sqrt(sum(OEFnormal0.^2)); if OEFnormal0length > 1e-6 %Safety check to avoid divide-by zero errors OEFnormal = OEFnormal0 / sqrt(sum(OEFnormal0.^2)); %A unit vector normal to the plane OEF %Check whether A and C are on opposite sides of the plane OEF, %and E and F are on opposite sides of the plane OAC Adist = dot(A, OEFnormal); Cdist = dot(C, OEFnormal); Edist = dot(E, OACnormal); Fdist = dot(F, OACnormal); if sign(Adist)~=sign(Cdist) && sign(Edist)~=sign(Fdist) %Check that you have to go the short way from E to F, %not the long way, in order to pass between A and C if dot((A+C)/2, (E+F)/2) > 0 %Measure the angle between the two planes orthogonality = acos(dot(OACnormal, OEFnormal)) * 180/pi; if orthogonality > 90 orthogonality = 180 - orthogonality; end %Measure the length of the great circle line, in degrees greatcirclelength = acos(dot(E,F)) * 180 / pi; %Get the indexes of the two cities, the four distances, the great circle length and the orthogonality. %If E is not the city on the West side, swap them over if Edist < 0 %E is already in the West pairparams = [cityno1 cityno2 Adist Cdist Edist Fdist greatcirclelength orthogonality]; else pairparams = [cityno2 cityno1 -Adist -Cdist Fdist Edist greatcirclelength orthogonality]; end numpairs = numpairs + 1; pairs(numpairs, :) = pairparams; end end end end end pairs = pairs(1:numpairs, :); maxnamelengthtouse = 32; for pairno = 1:numpairs pairparams = pairs(pairno, :); for citynoinpair = 1:2 cityno = pairparams(citynoinpair); fullname = sprintf('%s, %s', citynames{cityno,1}, citynames{cityno,2}); numchars = min(maxnamelengthtouse, length(fullname)); nametouse = ones(1, maxnamelengthtouse) .* '.'; nametouse(1:numchars) = fullname(1:numchars); if citynoinpair == 1 string1 = sprintf('%c', nametouse); else string2 = sprintf('%c', nametouse); end end fprintf('%3i %s - %s %9.6f %9.6f %9.6f %9.6f %9.3f %9.3f\n', pairno, string1, string2, pairparams(3:8)) end %Produce a kml file of all the great circle lines outfid = fopen('great_circle_results.kml', 'w'); fprintf(outfid, '\r\n'); fprintf(outfid, '\r\n'); fprintf(outfid, '\r\n'); fprintf(outfid, 'Track\r\n'); fprintf(outfid, '\r\n'); fprintf(outfid, '\r\n'); fprintf(outfid, '\r\n\r\n'); for pairno = 1:numpairs pair = pairs(pairno,:); fprintf(outfid, '\r\n'); fprintf(outfid, '%s, %s to %s, %s\r\n', citynames{pair(1),1}, citynames{pair(1),2}, citynames{pair(2),1}, citynames{pair(2),2}); fprintf(outfid, '#1\r\n'); fprintf(outfid, '\r\n'); fprintf(outfid, '1\r\n'); fprintf(outfid, 'clampToGround\r\n'); fprintf(outfid, '\r\n'); E = cityxyz(pair(1), :); F = cityxyz(pair(2), :); for l = 0:0.01:1 P = E*(1-l) + F*l; r = sqrt(sum(P.^2)); latitude = asin(P(3)/r) * 180/pi; longitude = atan2(P(2), P(1)) * 180/pi; fprintf(outfid, '%.6f,%.6f,%.1f\r\n', longitude, latitude, 1); end fprintf(outfid, '\r\n'); fprintf(outfid, '\r\n'); fprintf(outfid, '\r\n\r\n'); end fprintf(outfid, '\r\n'); fprintf(outfid, '\r\n'); fclose(outfid);