Skip to main content

Maps

Choropleth maps

Achoropleth mapis a color-coded map that assigns values as a function of location. Typically, the map is drawn along well-known political/administrative boundaries; hence, you don't have to create the maps yourself. A sliding scale of color helps you to quickly locate hot spots, where the value of interest may be lower or higher than other places on the map.

To create a choropleth map for your data, you need two things:

  1. Map data. Via itsHighchartsback end, RapidMiner provides:

    • a world map, partitioned into countries,
    • maps of each continent, partitioned into countries, and
    • country maps, partitioned into lower-level administrative units (US States/German Länder/French Régions).
  2. Anidentifier(e.g. a country name) that connects your data to the map. In principle, the ISO-3166 standard permits alpha or numeric codes as identifiers; in practice, RapidMiner uses the country name or name of the lower-level administrative unit.

Read more:

Highcharts GeoJSON

Map data

The map data provided by RapidMiner began its life on theNatural Earthwebsite, and was converted to GeoJSON format byHighcharts.

GeoJSON is a special JSON format that describes shapes (such as the boundaries of a country) and associates properties to those shapes (such as name and ISO-3166 codes). For example, the GeoJSONFeaturethat describes the United States of America has the following form:

{
"type":"Feature",
"id":"US",
"properties":{
"hc-group":"admin0",
"hc-middle-x":0.68,
"hc-middle-y":0.68,
"hc-key":"us",
"hc-a2":"US",
"name":"United States of America",
"labelrank":"2",
"country-abbrev":"U.S.A.",
"subregion":"Northern America",
“region-wb”:"North America",
"iso-a3":"USA",
"iso-a2":"US",
"woe-id":"23424977",
"continent":"North America"
},
"geometry":{
"type":"MultiPolygon",
"coordinates":[
[
[
[
261,
8307
],
[
etc.
],
[
308,
8292
]
]
]
]
}
},

Identifier

An important point to observe is that the country name in the Highcharts GeoJSON file is not necessarily the same as theEnglish short namegiven by ISO-3166. To use the maps provided by RapidMiner / Highcharts, you must use thenamegiven in the Highcharts GeoJSON file.

ISO-3166 name Highcharts name
United States of America (the) United States of America

For a complete list of ISO-3166 country names and codes, together with their Highcharts equivalents, see theappendix.

Note however that you can infer the Highcharts GeoJSON country name without ever opening a GeoJSON file, simply by:

  • creating the map in RapidMiner and
  • hovering the country with the mouse, until the country name appears.

Read more:

Example: Gapminder

Gapminder is an independent educational non-profit fighting global misconceptions.

The Gapminder Foundation collects and disseminates information about living standards in all parts of the world, to demonstrate how quickly and remarkably the global standard of living has increased, and to promote sustainable development.

TheGapminder websiteincludes a variety of global data.

GDP per capita in constant PPP dollars

For our example, we will plot the increase in GDP per capita in constant PPP dollars, from the year 2000 to the year 2020, using a modified version of aGapminder data set.

The following modifications:

  • 删除GDP per capita growth (%).
  • Restrict thetimedata to the years 2000 and 2020.
  • Based on the year, rewriteIncome per personasIncome 2000andIncome 2020. Deletetime.
  • Take the ratioIncome ratio=Income 2020/Income 2000.
  • Take the natural log:Log ratio= ln (Income ratio)
  • Rewrite countrynameasHighcharts name.

produce a table of this form:

geo name GDP total Income 2000 Income 2020 Income ratio Log ratio Highcharts name
afg Afghanistan 74652032324 578.0 1918.0 3.3183391003460208 1.199464386771006 Afghanistan
alb Albania 38173625553 5912.0 13265.0 2.2437415426251692 0.8081448039438024 Albania
dza Algeria 465890055133 8710.0 10624.0 1.219747416762342 0.1986438018696666 Algeria
and Andorra 4759876000 35399.0 61605.0 1.7403033984010847 0.5540594649234722 Andorra

Download gapminder-20-years.rmhdf5table

创建一个地图

Note that an app lives within a project. We havecreated a projectcalledgapminder. To create a map based on the above data table, take the following steps.

  1. From within the project, under theData tab, clickAdd Data,uploadgapminder-20-years.rmhdf5table.
  2. Content tab, selectCreate Appand name the appgapminder-progress.
  3. ClickAdd Widget,Editthe widget.
  4. In the dropdown, select the widget typeData.
  5. In the Data Set dropdown, selectgapminder-20-years.
  6. Visualize the data as aMap.

To configure the map, make the following selections:

  • Map Type: Regions
  • Map: All countries
  • Regions:name, the country name given by Gapminder
  • Value:Income ratio, the ratio betweenIncome 2020andIncome 2000
  • Aggregation: No Aggregation

Increase in GDP/capita (2000-2020)

The resulting map has at least two flaws that can be corrected:

  • The data for some countries, such as the United States and a few African countries, are not displayed on the map.
  • Since most countries have anIncome ratioapproximately equal to 1.0, the map is drowning in a sea of purple.

Improve the map

Correct identifiers

Regarding the missing countries, the issue can be resolved by taking note of the comment onidentifiersmade previously: the country name must be the same as the name in the Highcharts GeoJSON file.

Gapminder name Highcharts name
Guinea-Bissau Guinea Bissau
Cote d'Ivoire Ivory Coast
Congo, Rep. Republic of Congo
Congo, Dem. Rep. Democratic Republic of Congo
Tanzania United Republic of Tanzania
United States United States of America

The data columnHighcharts namemakes the appropriate corrections.

Improve color coding

Regarding the color coding, theHighcharts API for colorAxishas some useful comments:

Often times, the color axis needs to be adjusted to get the right color spread for the data. In addition to stops, consider using a logarithmic axis type, or settingminandmax为了避免颜色being determined by outliers.

With this comment in mind, and taking into account theHighcharts name, we reconfigure the map, make the following selections:

  • Map Type: Regions
  • Map: All countries
  • Regions:Highcharts name, the country name given by Highcharts
  • Value:Log ratio, the natural logarithm ofIncome ratio
  • Aggregation: No Aggregation

Increase in GDP/capita (2000-2020)

On this second map, the hot spots stand out more clearly.

  • The countries where the economy has contracted are purple: Venezuela, Libya, South Sudan, Syria, and Yemen. Most of these countries have experienced armed conflict.
  • The countries where the economy has expanded are yellow or orange. China stands out especially, but there has been dramatic progress in most of Asia and also in Eastern Europe.

Advanced settings

When you edit a map, clicking the buttonAdvanced Settingsgives you access to theHighcharts API. For maps, possible settings of interest include:

To change the configuration of thetitle, for example, enter a JSON snippet similar to the following into the form field:

{
"title":{
"text":"Log[ (Income 2020) / (Income 2000) ]",
"align":"left",
"x":90,
"y":60,
"style":{
"color":"#772222"
}
}
}

Read more:

Appendix: conversion table

The table below presents the ISO-3166-1 standard for country codes, and shows eventual differences between theEnglish short nameidentified in ISO-3166-1 and the country names identified by Highcharts. To get your data on the map, you need to use theHighcharts name.

Download the conversion table

English short name Alpha-2 code Alpha-3 code Numeric Highcharts name
Afghanistan AF AFG 4 Afghanistan
Albania AL ALB 8 Albania
Algeria DZ DZA 12 Algeria
American Samoa AS ASM 16 American Samoa
Andorra AD AND 20 Andorra
Angola AO AGO 24 Angola
Anguilla AI AIA 660
Antarctica AQ ATA 10
Antigua and Barbuda AG ATG 28 Antigua and Barbuda
Argentina AR ARG 32 Argentina
Armenia AM ARM 51 Armenia
Aruba AW ABW 533
Australia AU AUS 36 Australia
Austria AT AUT 40 Austria
Azerbaijan AZ AZE 31 Azerbaijan
Bahamas (the) BS BHS 44 The Bahamas
Bahrain BH BHR 48 Bahrain
Bangladesh BD BGD 50 Bangladesh
Barbados BB BRB 52 Barbados
Belarus BY BLR 112 Belarus
Belgium BE BEL 56 Belgium
Belize BZ BLZ 84 Belize
Benin BJ BEN 204 Benin
Bermuda BM BMU 60
Bhutan BT BTN 64 Bhutan
Bolivia (Plurinational State of) BO BOL 68 Bolivia
Bonaire, Sint Eustatius and Saba BQ BES 535
Bosnia and Herzegovina BA BIH 70 Bosnia and Herzegovina
Botswana BW BWA 72 Botswana
Bouvet Island BV BVT 74
Brazil BR BRA 76 Brazil
British Indian Ocean Territory (the) IO IOT 86
Brunei Darussalam BN BRN 96 Brunei
Bulgaria BG BGR 100 Bulgaria
Burkina Faso BF BFA 854 Burkina Faso
Burundi BI BDI 108 Burundi
Cabo Verde CV CPV 132 Cape Verde
Cambodia KH 博物馆 116 Cambodia
Cameroon CM CMR 120 Cameroon
Canada CA CAN 124 Canada
Cayman Islands (the) KY CYM 136
Central African Republic (the) CF CAF 140 Central African Republic
Chad TD TCD 148 Chad
Chile CL CHL 152 Chile
China CN CHN 156 China
Christmas Island CX CXR 162
Cocos (Keeling) Islands (the) CC CCK 166
Colombia CO COL 170 Colombia
Comoros (the) KM COM 174 Comoros
Congo (the Democratic Republic of the) CD COD 180 Democratic Republic of the Congo
Congo (the) CG COG 178 Republic of Congo
Cook Islands (the) CK COK 184
Costa Rica CR CRI 188 Costa Rica
Croatia HR HRV 191 Croatia
Cuba CU CUB 192 Cuba
Curaçao CW CUW 531
Cyprus CY CYP 196 Cyprus
Czechia CZ CZE 203 Czech Republic
Côte d'Ivoire CI CIV 384 Ivory Coast
Denmark DK DNK 208 Denmark
Djibouti DJ DJI 262 Djibouti
Dominica DM DMA 212 Dominica
Dominican Republic (the) DO DOM 214 Dominican Republic
Ecuador EC ECU 218 Ecuador
Egypt EG EGY 818 Egypt
El Salvador SV SLV 222 El Salvador
Equatorial Guinea GQ GNQ 226 Equatorial Guinea
Eritrea ER ERI 232 Eritrea
Estonia EE EST 233 Estonia
Eswatini SZ SWZ 748 Swaziland
Ethiopia ET ETH 231 Ethiopia
Falkland Islands (the)[Malvinas] FK FLK 238
Faroe Islands (the) FO FRO 234 Faroe Islands
Fiji FJ FJI 242 Fiji
Finland FI FIN 246 Finland
France FR FRA 250 France
French Guiana GF GUF 254
French Polynesia PF PYF 258
French Southern Territories (the) TF ATF 260
Gabon GA GAB 266 Gabon
冈比亚(the) GM GMB 270 Gambia
Georgia GE GEO 268 Georgia
Germany DE DEU 276 Germany
Ghana GH GHA 288 Ghana
Gibraltar GI GIB 292
Greece GR GRC 300 Greece
Greenland GL GRL 304 Greenland
Grenada GD GRD 308 Grenada
Guadeloupe GP GLP 312
Guam GU GUM 316 Guam
Guatemala GT GTM 320 Guatemala
Guernsey GG GGY 831
Guinea GN GIN 324 Guinea
Guinea-Bissau GW GNB 624 Guinea Bissau
Guyana GY GUY 328 Guyana
Haiti HT HTI 332 Haiti
Heard Island and McDonald Islands HM HMD 334
Holy See (the) VA VAT 336 Vatican
Honduras HN HND 340 Honduras
Hong Kong HK HKG 344
Hungary HU HUN 348 Hungary
Iceland IS ISL 352 Iceland
India IN IND 356 India
Indonesia ID 印度尼西亚的 360 Indonesia
Iran (Islamic Republic of) IR IRN 364 Iran
Iraq IQ IRQ 368 Iraq
Ireland IE IRL 372 Ireland
Isle of Man IM IMN 833
Israel IL ISR 376 Israel
Italy IT ITA 380 Italy
Jamaica JM JAM 388 Jamaica
Japan JP JPN 392 Japan
Jersey JE JEY 832
Jordan JO JOR 400 Jordan
Kazakhstan KZ KAZ 398 Kazakhstan
Kenya KE KEN 404 Kenya
Kiribati KI KIR 296 Kiribati
Korea (the Democratic People's Republic of) KP PRK 408 North Korea
Korea (the Republic of) KR KOR 410 South Korea
Kuwait KW KWT 414 Kuwait
Kyrgyzstan KG KGZ 417 Kyrgyzstan
Lao People's Democratic Republic (the) LA LAO 418 Laos
Latvia LV LVA 428 Latvia
Lebanon LB LBN 422 Lebanon
Lesotho LS LSO 426 Lesotho
Liberia LR LBR 430 Liberia
Libya LY LBY 434 Libya
Liechtenstein LI LIE 438 Liechtenstein
Lithuania LT LTU 440 Lithuania
Luxembourg LU LUX 442 Luxembourg
Macao MO MAC 446
Madagascar MG MDG 450 Madagascar
Malawi MW MWI 454 Malawi
Malaysia MY MYS 458 Malaysia
Maldives MV MDV 462 Maldives
Mali ML 多层互连 466 Mali
Malta MT MLT 470 Malta
Marshall Islands (the) MH MHL 584 Marshall Islands
Martinique MQ MTQ 474
Mauritania MR MRT 478 Mauritania
Mauritius MU MUS 480 Mauritius
Mayotte YT MYT 175
Mexico MX MEX 484 Mexico
Micronesia (Federated States of) FM FSM 583 Federated States of Micronesia
Moldova (the Republic of) MD MDA 498 Moldova
Monaco MC MCO 492 Monaco
Mongolia MN MNG 496 Mongolia
Montenegro ME MNE 499 Montenegro
Montserrat MS MSR 500
Morocco MA MAR 504 Morocco
Mozambique MZ MOZ 508 Mozambique
Myanmar MM MMR 104 Myanmar
Namibia NAM 516 Namibia
Nauru NR NRU 520 Nauru
Nepal NP NPL 524 Nepal
Netherlands (the) NL NLD 528 Netherlands
New Caledonia NC NCL 540
New Zealand NZ NZL 554 New Zealand
Nicaragua NI NIC 558 Nicaragua
尼日尔() NE NER 562 Niger
Nigeria NG NGA 566 Nigeria
Niue NU NIU 570
Norfolk Island NF NFK 574
North Macedonia MK MKD 807 Macedonia
Northern Mariana Islands (the) MP MNP 580 Northern Mariana Islands
Norway NO NOR 578 Norway
Oman OM OMN 512 Oman
Pakistan PK PAK 586 Pakistan
Palau PW PLW 585 Palau
Palestine, State of PS PSE 275
Panama PA PAN 591 Panama
Papua New Guinea PG PNG 598 Papua New Guinea
Paraguay PY PRY 600 Paraguay
Peru PE PER 604 Peru
Philippines (the) PH PHL 608 Philippines
Pitcairn PN PCN 612
Poland PL POL 616 Poland
Portugal PT PRT 620 Portugal
Puerto Rico PR PRI 630 Puerto Rico
Qatar QA QAT 634 Qatar
Romania RO ROU 642 Romania
Russian Federation (the) RU RUS 643 Russia
Rwanda RW RWA 646 Rwanda
Réunion RE REU 638
Saint Barthélemy BL BLM 652
Saint Helena, Ascension and Tristan da Cunha SH SHN 654
Saint Kitts and Nevis KN KNA 659 Saint Kitts and Nevis
Saint Lucia LC LCA 662 Saint Lucia
Saint Martin (French part) MF MAF 663
Saint Pierre and Miquelon PM SPM 666
Saint Vincent and the Grenadines VC VCT 670 Saint Vincent and the Grenadines
Samoa WS WSM 882 Samoa
San Marino SM SMR 674 San Marino
Sao Tome and Principe ST STP 678 Sao Tome and Principe
Saudi Arabia SA SAU 682 Saudi Arabia
Senegal SN SEN 686 Senegal
Serbia RS SRB 688 Republic of Serbia
Seychelles SC SYC 690 Seychelles
Sierra Leone SL SLE 694 Sierra Leone
Singapore SG SGP 702 Singapore
Sint Maarten (Dutch part) SX SXM 534
Slovakia SK SVK 703 Slovakia
Slovenia SI SVN 705 Slovenia
Solomon Islands SB SLB 90 Solomon Islands
Somalia SO SOM 706 Somalia
South Africa ZA ZAF 710 South Africa
South Georgia and the South Sandwich Islands GS SGS 239
South Sudan SS SSD 728 South Sudan
Spain ES ESP 724 Spain
Sri Lanka LK LKA 144 Sri Lanka
Sudan (the) SD SDN 729 Sudan
Suriname SR SUR 740 Suriname
Svalbard and Jan Mayen SJ SJM 744
Sweden SE SWE 752 Sweden
Switzerland CH CHE 756 Switzerland
Syrian Arab Republic (the) SY SYR 760 Syria
Taiwan (Province of China) TW TWN 158 Taiwan
Tajikistan TJ TJK 762 Tajikistan
Tanzania, the United Republic of TZ TZA 834 United Republic of Tanzania
Thailand TH THA 764 Thailand
Timor-Leste TL TLS 626 East Timor
Togo TG TGO 768 Togo
Tokelau TK TKL 772
Tonga TO TON 776 Tonga
Trinidad and Tobago TT TTO 780 Trinidad and Tobago
Tunisia TN TUN 788 Tunisia
Turkey TR TUR 792 Turkey
Turkmenistan TM TKM 795 Turkmenistan
Turks and Caicos Islands (the) TC TCA 796
Tuvalu TV TUV 798 Tuvalu
Uganda UG UGA 800 Uganda
Ukraine UA UKR 804 Ukraine
United Arab Emirates (the) AE ARE 784 United Arab Emirates
United Kingdom of Great Britain and Northern Ireland (the) GB GBR 826 United Kingdom
United States Minor Outlying Islands (the) UM UMI 581 United States Minor Outlying Islands
United States of America (the) US USA 840 United States of America
Uruguay UY URY 858 Uruguay
Uzbekistan UZ UZB 860 Uzbekistan
Vanuatu VU VUT 548 Vanuatu
Venezuela (Bolivarian Republic of) VE VEN 862 Venezuela
Viet Nam VN VNM 704 Vietnam
Virgin Islands (British) VG VGB 92
Virgin Islands (U.S.) VI VIR 850 United States Virgin Islands
Wallis and Futuna WF WLF 876
Western Sahara* EH ESH 732 Western Sahara
Yemen YE YEM 887 Yemen
Zambia ZM ZMB 894 Zambia
Zimbabwe ZW ZWE 716 Zimbabwe
Åland Islands AX ALA 248