home

military spending

please download these two images. they were made using freely available data and tools - i've included a description of the technique, scripts and data files that you can use as the basis for further work.

note - someone drew my attention to the fact that russia does not appear on this map! this is unintentional - i assume there was a parsing error that stopped it being listed. at some point i will go back and check/regenerate the map (or maybe someone else could?!).

three globes

three views of the earth. each country is represented by a circle that shows the amount of money spent on the military (size of circle) and what fraction of the country's earnings that uses (colour).

equal area map

the same data as above, presented as ellipses on a cylindrical projection. the countries are not named, and the scaling is slightly different, but once you see africa (central collection of small dots) the layout is clear. the usa dominates the upper/left third of the map.

contents

downloads

frequently asked questions

  1. what are the pictures?

    the two images (1; 2) above show which countries spend the most money per year on the military. the size of the coloured blobs is proportional to the total amount spent. the colour shows what fraction of each country's gdp is used (gdp is a measure of how much money the country has, so "hotter" colours show countries that spend a larger fraction of their money on the military).

    note that i started this project using 2004 data; the 2005 factbook is now available, but the values and images here still use the 2004 figures.

  2. which countries are shown?

    the globes image includes the names of the largest spenders (to read them, you probably need to download a larger version).

    the images are generated from information in the cia world factbook, so any country in that publication should be shown (as long as the necessary values are present). if you think a country is missing, please contact me.

  3. which countries spend most/least?

    see the table of data at the bottom of this page.

  4. how did you do this?

    i downloaded the freely available data from the cia world factbook, converted the pages to xhtml with tidy, extracted the basic information with an xsl script, generated the images in svg format using more scripts, and then viewed/converted the images using the batik toolkit.

    if you're not used to the technology, it may not be clear "where the image comes from" - you need to understand that everything is based on xml. the data are in xml ("tidy" is a program that converts web pages to xml) and the images themselves are described in xml (a format called svg). so to make the image, i simply rewrite the xml, from a form that says "country x has longitude and latitutde x,y and spent z" to "draw a circle at x,y of size z". that transformation is described using the xsl language - saxon is the interpreter that reads the description and transforms the data.

    for another example, using svg generated by javascript code inside the image, see here.

  5. why is the scale for the globes only "rough"?

    in the globes image each country's spending is shown with a circle. to make the globes look "real" these circles are shown in projection (as ellipses), but the transformation is only approximate (svg only supports linear coordinate transforms, as far as i can see, which makes projecting shapes onto a sphere difficult).

    in other words, i couldn't find a simple way to do what i wanted correctly with the tools i was using. so i used an approximation that should be reasonably fair, but isn't perfect (you can see this if you look at the blobs near the edge of a globe - they don't curve round to follow the curvature of the earth as they should).

  6. can i change these?

    yes, as long as you follow the licence conditions. you can download all the data and scripts. i also give pointers to the software you need.

  7. what licence is used?

    Creative Commons Licence

    everything here is available under a creative commons licence. basically, you can do what you like as long as:

    otherwise, please contact me to discuss possible alternatives.

  8. what software do i need?

    i used the following packages:

    these can be downloaded from the links above.

  9. what data do i need?

    see the downloads. if you want to start working with the worldbook data directly, you need to get a copy from the cia world factbook

  10. how can i generate images from the svg files?

    once you have downloaded the svg files, and installed batik, you can generate images of any size in a variety of formats. a typical command would be:

    rasterizer -d arms2-2048.png -w 2048 arms2.svg

    which, in this case, generates a png image (from the extension of the file arms-2048.png) with a width of 2048 pixels, using the data in arms2.svg. i have rasterizer defined as:

    alias rasterizer="java -Xmx500m -jar c:\\\\Archive\\\\Batik\\\\batik-1.5.1\\\\batik-rasterizer.jar"

    but your particular configuration will depend on your operating system (see the installation instructions for batik).

  11. where can i find more information?

    for more information on xsl, svg and related technologies, the best place to start is probably the w3c.

    for more global statistics, nationmaster is pretty interesting.

    obleek has a good animated map showing us/coalition war casualties in iraq.

  12. why did you do this?

    partly because i was stuck with nothing to do on a trip for work, partly because i think this kind of information is important and interesting, but mainly because i want to encourage geektivism - the use of opensource tools, freely available and copyleft information, computers and the internet to understand and change the world.

  13. i have a comment/correction/request - how can i contact you?

    feel free to email me at andrew@acooke.org.

spending data

this is also available in an xml file for download above.

country annual budget (us$) % gdp
United States 370700000000 3.3
China 60000000000 3.5
France 45238100000 2.6
United Kingdom 42836500000 2.4
Japan 42488100000 1
Germany 35063000000 1.5
Italy 28182800000 1.9
Saudi Arabia 18000000000 10
Korea, South 14522000000 2.7
Australia 14120100000 2.8
India 14018800000 2.4
Turkey 12155000000 5.3
Brazil 10439400000 2.1
Spain 9906500000 1.2
Canada 9801700000 1.1
Israel 9110000000 8.7
Netherlands 8044400000 1.6
Taiwan 7611700000 2.7
Greece 7288900000 4.3
Korea, North 5217400000 22.9
Mexico 5168300000 0.9
Singapore 4470000000 4.9
Sweden 4395000000 2.1
Argentina 4300000000 1.3
Iran 4300000000 3.3
Norway 4033500000 1.9
Belgium 3999000000 1.3
Poland 3500000000 1.71
Portugal 3497800000 2.3
Colombia 3300000000 3.4
Denmark 3271600000 1.6
Chile 2839600000 4
Pakistan 2700000000 3.9
South Africa 2653400000 1.7
Switzerland 2548000000 1
Kuwait 2500400000 5.8
Egypt 2443200000 3.6
Morocco 2297200000 4.8
Algeria 2196600000 3.5
Jordan 2043200000 20.2
Finland 1800000000 2
Thailand 1775000000 1.8
Malaysia 1690000000 2.03
United Arab Emirates 1600000000 3.1
Austria 1497000000 0.85
Iraq 1300000000
Libya 1300000000 3.9
Czech Republic 1190200000 2.1
New Zealand 1147000000 1
Venezuela 1125600000 1.3
Hungary 1080000000 1.75
Indonesia 1000000000 1.3
Philippines 995000000 1.5
Romania 985000000 2.47
Yemen 885600000 7.9
Syria 858000000 5.9
Peru 829400000 1.3
Qatar 723000000 10
Ireland 700000000 0.9
Serbia and Montenegro 654000000
Ecuador 650000000 2.4
Vietnam 650000000 2.5
Bahrain 618100000 7.5
Ukraine 617900000 1.4
Bangladesh 606800000 1.2
Sudan 581000000 2.5
Cuba 572300000 1.8
Lebanon 541000000 4.8
Croatia 520000000 2.39
Sri Lanka 518000000 3.2
Nigeria 469800000 0.9
Slovakia 406000000 1.89
Cyprus 384000000 3.8
Slovenia 370000000 1.7
Bulgaria 356000000 2.6
Tunisia 356000000 1.5
Ethiopia 345000000 5.2
Brunei 339500000 5.9
Botswana 298900000 3.6
Nepal 295000000 1.6
Angola 265100000 1.9
Oman 242070000 11.4
Bosnia and Herzegovina 234300000 4.5
Luxembourg 231600000 0.9
Kenya 231000000 1.8
Lithuania 230800000 1.9
Kazakhstan 221800000 0.9
Uruguay 217900000 2
Guatemala 202600000 0.8
Macedonia 200000000 6
Uzbekistan 200000000 2
Cameroon 189200000 1.4
Dominican Republic 180000000 1.1
Belarus 176100000 1.4
Cote d'Ivoire 173600000 1.2
El Salvador 157000000 1.1
Estonia 155000000 2
Gabon 149300000 2
Panama 145000000 1.2
Armenia 135000000 6.5
Uganda 128200000 2.1
Bolivia 127000000 1.6
Azerbaijan 121000000 2.6
Congo, Democratic Republic of the 115500000 1.4
Cambodia 112000000 3
Namibia 111600000 2.5
Zimbabwe 105000000 1.7
Mozambique 101300000 2.2
Honduras 99800000 1.5
Benin 98300000 2.7
Senegal 95800000 1.5
Turkmenistan 90000000 3.4
Latvia 87000000 1.2
Eritrea 77900000 11.8
Equatorial Guinea 75100000 2.5
Madagascar 69800000 1.2
Congo, Republic of the 68600000 2.8
Trinidad and Tobago 66700000 0.6
Costa Rica 64000000 0.4
Afghanistan 61000000 1
Guinea 58500000 1.7
Albania 56500000 1.49
Chad 55400000 2.1
Burkina Faso 52700000 1.6
Paraguay 52700000 0.9
Mali 51100000 1.3
Rwanda 47700000 2.9
Ghana 44000000 0.6
Maldives 43100000 8.6
Zambia 42600000 0.9
Mauritania 40800000 3.7
Burma 39000000 2.1
Tajikistan 35400000 3.9
Fiji 34000000 2.2
Burundi 33300000 6
Malta 33300000 0.7
Togo 32600000 1.9
Lesotho 32500000 2.6
Jamaica 31000000 0.4
Nicaragua 30800000 1.2
Swaziland 29000000 1.8
Djibouti 26500000 4.4
Haiti 25800000 0.9
Mongolia 23100000 2.2
Georgia 23000000 0.59
Niger 21700000 1.1
Tanzania 20300000 0.2
Kyrgyzstan 19200000 1.4
Somalia 18900000 0.9
Belize 18000000 2
Papua New Guinea 16900000 1.4
Central African Republic 14500000 1.1
Cape Verde 12300000 1.5
Sierra Leone 11700000 1.5
Seychelles 11600000 1.8
Malawi 11500000 0.7
Bhutan 11200000 1.9
Mauritius 11200000 0.2
Laos 10900000 0.5
Liberia 10000000 1.3
Moldova 9500000 0.4
Guinea-Bissau 8400000 2.8
Suriname 7500000 0.7
Guyana 6500000 0.8
Comoros 6000000 3
East Timor 4400000
Bermuda 4030000 0.11