Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a2444a4b4f8015db

Jump to content

Template:Choropleth map/doc

From Wikipedia, the free encyclopedia

Use this template to create choropleth maps.

Parameters

[edit]
  • entities – List of entities to color, separated by semicolons or newlines (example). Can be any country, state, province, municipality, city, etc.[1] Aliases: countries, states, provinces. Entities must be specified by the exact title of their Wikipedia article (redirects don't work) or by their Wikidata identifier (Q123). Countries may also be specified by their two-digit ISO codes (example). Each entity may be preceded by a value followed by a colon (:) that will determine the color of the entity. Colors can be specified by:
    • Hexadecimal codes, like #D8757E or #faa (example).
    • Plain numbers, like 400. The color will be shaded proportionally to the maximum value among all the entities (example).
    • Percentages, like 40%. The color will be shaded proportionally (example).
  • color – Initial color of the colored entities (in hexadecimal). Defaults to red (#f00).
  • min-opacity - Minumum opacity of the colored entities. The value must be between 0 and 1 (for example 0.3). Defaults to 0. This is useful when coloring entities based on a value or percentage, and the minimum value is too low to be visible (example).
  • logarithmic-scale - Set this to any value to use a logarithmic scale rather than a linear scale. This is useful when coloring entities based on a value or percentage, and the values span several orders of magnitude (example).
  • view – Area where to center the map (examples). Defaults to the world map. Can be any continent, country, state, province, municipality, city, etc.[1] Additionally, North America, South America, Central America and Latin America also work. Setting this to auto will center around the colored entities (example).
  • latitude – Latitude where to center the map. If not specified, it will be guessed from the specified view or entities.
  • longitude – Longitude where to center the map. If not specified, it will be guessed from the specified view or entities.
  • zoom – Level of map detail. Zoom level 0 displays the entire available map, and zoom level 19 shows the highest level of detail. If not specified, a best–guess automatic zoom level is applied based on the selected view or entities.
  • width – Width of the map in pixels, or full to fill the parent container. Defaults to 250 (the standard width of image thumbnails).
  • height – Height of the map in pixels. Defaults to 200.
  • align – Horizontal position of the map on the page. Can be right, center or left. Defaults to right (like image thumbnails).
  • frameless – Set this to any value to remove the frame around the map. It has no effect if caption or legends are set.
  • mapstyle – Style of the basemap. There are currently only two styles available: one with labels (osm-intl) and one without labels (osm). Defaults to osm-intl.
  • altAlternative text of the map.
  • caption – Text below the map.
  • legends – Set this to any value to generate automatic legends below the map (examples). If the automatic legends are not good enough, you can omit this parameter and use the caption parameter to build your own legends using Template:Legend.
  • source – Source of geographical data in Commons. Defaults to ChoroplethMap.map, which loads Commons:Data:ChoroplethMap.map. Another example could be France Departments.map which would load Commons:Data:France Departments.map (example). When an entity is not found in the data source from Commons, it is fetched from Open Street Map, which works but is slower. This parameter is also useful if you want to show country borders other than the default de facto borders (see #Disputed borders).

Examples

[edit]

Basic

[edit]
MarkupRenders as
{{Choropleth map
| countries = Brazil; Mexico; Egypt; China; Australia
}}
Map

Views

[edit]
MarkupRenders as
{{Choropleth map
| view = South America
| height = 300
| countries = Argentina; Brazil; Chile; Uruguay
}}
Map
MarkupRenders as
{{Choropleth map
| view = United States
| zoom = 2
| latitude = 45
| longitude = -103
| states = California; Texas; New York (state)
}}
Map
MarkupRenders as
{{Choropleth map
| view = New York
| entities =
#aaf: Manhattan
#afa: Brooklyn
#faa: Queens
#aff: The Bronx
#faf: Staten Island
}}
Map

ISO codes

[edit]
MarkupRenders as
{{Choropleth map
| color = #aaf
| countries = CN; US; DE; BR; AU; EG
}}
Map

Color groups

[edit]
MarkupRenders as
{{Choropleth map
| countries =
#faa: Mexico; United States; Brazil
#aaf: Italy; Spain; France; Germany
#afa: China; India
#faf: Australia
}}
Map

Color by percentage

[edit]
MarkupRenders as
{{Choropleth map
| height = 250
| view = North America
| countries =
80%: United States
60%: Canada
40%: Mexico
}}
Map

Color by value

[edit]
MarkupRenders as
{{Choropleth map
| view = South America
| height = 300
| color = #00f
| countries =
400: BR
300: UY; CL; PE
200: AR; PY
100: BO; CO; VE; EC
#aff: SR; GY; GF
}}
Map

Automatic legends

[edit]
MarkupRenders as
{{Choropleth map
| legends = yes
| view = South America
| height = 300
| countries =
70%: Uruguay
60%: Brazil
50%: Chile; Argentina; Ecuador
40%: Peru; Paraguay; Bolivia
30%: Colombia; Venezuela
#aff: Guyana; Suriname; French Guiana
}}
MarkupRenders as
{{Choropleth map
| caption = GDP per capita (in thousands of USD):
| legends = yes
| height = 250
| view = North America
| countries =
94.4: United States
60.3: Canada
15.7: Mexico
}}
Map
GDP per capita (in thousands of USD):
60.3: Canada
15.7: Mexico

Low values and wide ranges

[edit]
MarkupRenders as
{{Choropleth map
| view = auto
| zoom = 2
| height = 250
| min-opacity = 0.1
| logarithmic-scale = yes
| caption = Population (in millions):
| legends = yes
| countries =
1470: India
1404: China
285.7: Indonesia
122.5: Japan
116.8: Philippines
101.6: Vietnam
71.6: Thailand
54.9: Myanmar
51.6: South Korea
36.0: Malaysia
29.6: Nepal
23.0: Taiwan
17.8: Cambodia
7.9: Laos
5.9: Singapore
1.4: Timor-Leste
0.5: Brunei
}}
Map
Population (in millions):
1470: India
285.7: Indonesia
122.5: Japan
101.6: Vietnam
71.6: Thailand
54.9: Myanmar
36.0: Malaysia
29.6: Nepal
23.0: Taiwan
17.8: Cambodia
7.9: Laos
0.5: Brunei

Alternative source

[edit]
MarkupRenders as
{{Choropleth map
| source = France Departments.map
| entities = Finistère; Nord (French department); Bas-Rhin; Var (department); Pyrénées-Atlantiques; Indre
}}
Map

Disputed borders

[edit]

By default, this template uses country data from Commons:Data:ChoroplethMap.map, which aims to reflect de facto borders. If you want to display different borders, you can create a new map page on Commons by copy-pasting ChoroplethMap.map, modifying the borders (https://geojson.io is a useful tool for that), and then loading the modified data using the "source" parameter of this template.

Template data

[edit]

Use this template to create choropleth maps.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Entitiesentities countries states provinces

List of entities to color, separated by semicolons or newlines.

Example
Argentina; Brazil; Colombia
Stringsuggested
Colorcolor

Initial color of the colored entities (in hexadecimal).

Default
#f00
Example
#afa
Stringoptional
Viewview

Area where to center the map.

Example
South America
Stringoptional
Latitudelatitude

Latitude where to center the map.

Example
45
Numberoptional
Longitudelongitude

Longitude where to center the map.

Example
-103
Numberoptional
Zoomzoom

Level of map detail.

Example
2
Numberoptional
Widthwidth

Width of the map in pixels, or "full" to fill the parent container.

Suggested values
full
Default
250
Example
300
Numberoptional
Heightheight

Height of the map in pixels.

Example
300
Numberoptional
Alignalign

Horizontal position of the map on the page.

Suggested values
left center right
Default
right
Example
left
Stringoptional
Framelessframeless

Set this to any value to remove the frame around the map.

Example
yes
Booleanoptional
Map stylemapstyle

Style of the basemap.

Suggested values
oms oms-intl
Default
osm-intl
Example
oms
Stringoptional
Alternative textalt

Alternative text of the map.

Stringoptional
Captioncaption

Text below the map.

Stringoptional
Legendslegends

Set this to any value to generate automatic legends below the map.

Example
yes
Booleanoptional
Sourcesource

Source of geographical data in Commons.

Default
ChoroplethMap.map
Example
France Departments.map
Stringoptional

Notes

[edit]
  1. 1 2 Technically, any entity that has an area defined in Open Street Map and is linked to a Wikidata entity.