This is the full developer documentation for Geografica
# Geografica
> Documentation for Geografica, business intelligence on maps
Geografica puts your data on a map. Upload a table of values by country or by region, and Geografica draws it on the boundaries of those regions, the [world regions](/world-regions/), which it keeps up to date for the whole world.
| | |
| -------- | ------------------------------------------------------------------------------------------------------ |
| Site | [geografica.app](https://geografica.app) |
| API docs | [docs](https://api.geografica.app/v1/docs), [openapi.json](https://api.geografica.app/v1/openapi.json) |
## Features
[Section titled “Features”](#features)
* **[Choropleth maps](/canvas-layers/choropleth/)**: colour countries and regions by a value from your data, with charts drawn from the same numbers.
* **Embedding**: put any public canvas on your own website with a single `iframe`, copied from the **Embed** button of the canvas. The embedded map stays live, showing the canvas as it is saved, so it never needs updating. See [Embed a Canvas](/canvases/#embed-a-canvas) for the details, or browse the [public canvases](https://geografica.app/canvases) to find one to embed.
## AI Agents
[Section titled “AI Agents”](#ai-agents)
This documentation is also published as plain text for AI agents and LLMs, following the [llms.txt](https://llmstxt.org) convention:
* [llms.txt](/llms.txt): the index, start here
* [llms-full.txt](/llms-full.txt): the complete documentation in one file
* [llms-small.txt](/llms-small.txt): a compact version, for a shorter context
* [openapi.json](https://api.geografica.app/v1/openapi.json): every endpoint of the Geografica API
# Choropleth Map
> Colour regions by a value from your data, such as population density across Europe, and embed the live map in any web page
A [choropleth map](https://en.wikipedia.org/wiki/Choropleth_map) colours each region by a value from your data, so differences between countries, provinces or districts show at a glance. It is the canvas to reach for when your data is a table of values by region, such as population, income, votes or prices.
## Example
[Section titled “Example”](#example)
The map below is a live [Geografica](https://geografica.app) canvas, embedded in this page: [Population density by NUTS 3 region](https://geografica.app/orgs/geografica/canvases/402d1e78bfc44b14a09e474dfe98c51d). It colours the [world regions](/world-regions/) of Europe, down to level 3, by their population density, with data from [Eurostat](https://ec.europa.eu/eurostat/databrowser/view/demo_r_d3dens/default/table) under the [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) licence. Hover a region to read its value.
[Population density by NUTS 3 region](https://geografica.app/embed/canvases/402d1e78bfc44b14a09e474dfe98c51d)
## How It Works
[Section titled “How It Works”](#how-it-works)
A choropleth is a canvas layer that reads a dataset and joins each row to a [world region](/world-regions/) by its code. The layer colours its regions by one value column, with a palette:
* **Palette**: a colour scheme from the [d3 colour schemes](https://d3js.org/d3-scale-chromatic), many of them from [ColorBrewer](https://colorbrewer2.org/), or a palette of your organization. The example uses `YlOrRd`, yellow to red.
* **Ramp or categories**: a ramp of colours suits a column of magnitudes, and distinct hues suit a column of categories.
* **Classes**: the example splits the values into quantiles, so each colour covers the same number of regions. This keeps a few very dense cities from washing out the rest of the map.
A layer can also carry a time column. The canvas then shows a timeline, and the map moves through the years of the data.
## Charts
[Section titled “Charts”](#charts)
A canvas can draw charts with the map, reading the same layer, so the chart and the map always show the same numbers in the same colours. The example has two:
* a **bar chart** of the regions ranked by value, here the 20 most densely populated level 3 regions
* a **time series** of the value over every year of the data
## More Examples
[Section titled “More Examples”](#more-examples)
Other public choropleth canvases on Geografica:
* [European Immigration](https://geografica.app/orgs/geografica/canvases/a14322caec1c4787a3c0d9e36254084d)
* [Brexit Referendum](https://geografica.app/orgs/geografica/canvases/9661e8b0951947c78db1f36a1037a14b)
Browse every public canvas at [geografica.app/canvases](https://geografica.app/canvases).
## Build Your Own
[Section titled “Build Your Own”](#build-your-own)
Upload a table of values by region on [geografica.app](https://geografica.app), open it and press **Create canvas**: the canvas starts as a choropleth of the dataset. [Canvases](/canvases/) covers creating, editing, publishing and [embedding](/canvases/#embed-a-canvas) a canvas step by step. To work with canvases and datasets from code, see the [API documentation](https://api.geografica.app/v1/docs) and its [OpenAPI specification](https://api.geografica.app/v1/openapi.json). For free tools to prepare boundaries and pick colours, see [Map Tools](/tools/).
# Elevation
> Shade a range of heights or sea depths on a canvas, such as everything above 2,000 m, or draw its elevation lines, with no data of your own
An elevation layer draws the height of the land and the depth of the sea under the other layers of a [canvas](/canvases/). It needs no dataset: the heights come from public elevation data, so any canvas can show where the mountains, the continental shelf or the deep ocean are.
## What It Draws
[Section titled “What It Draws”](#what-it-draws)
The layer keeps the heights between a bottom and a top, in metres above sea level, with depths below it as negative values. Either end can be left open:
* **Above 2,000 m**: a bottom of 2,000 and no top, the high mountains.
* **Deeper than 200 m**: a top of −200 and no bottom, the sea past the continental shelf.
* **Between −50 m and 50 m**: both ends set, the land and sea close to the coastline.
It draws that range in one of two ways:
* **Shaded range**: the range is coloured with a palette, lighter to darker across it, and everything outside it is left clear. Depths start on blues and heights on earth tones, and any palette can be picked instead.
* **Elevation lines**: lines of equal height across the range, the [contour lines](https://en.wikipedia.org/wiki/Contour_line) of a topographic map. They are a set number of metres apart close up and wider apart further out, and every fifth line is thicker and labelled with its height.
## Add an Elevation Layer
[Section titled “Add an Elevation Layer”](#add-an-elevation-layer)
On the **Layers** tab of the canvas editor, press **Elevation**. The new layer shades everything above 2,000 m, and its settings are:
* **Draw**: a shaded range or elevation lines.
* **From** and **To**: the bottom and the top of the range, in metres. Leave one empty to leave that side open.
* **Every**: the metres between two elevation lines close up, lines only.
* **Opacity**: how strongly the layer covers the map under it.
* **Palette**: the colours of a shaded range, and whether they run reversed.
A canvas can hold several elevation layers, for instance the high mountains shaded and the sea floor drawn as lines.
## Where the Heights Come From
[Section titled “Where the Heights Come From”](#where-the-heights-come-from)
The heights are read from the [Terrain Tiles](https://registry.opendata.aws/terrain-tiles/) of the AWS Open Data registry, which merge national and global elevation models. Two limits follow from the data:
* **Sea depths are coarse.** The sea floor comes from a global model with one value every one to two kilometres, which suits an ocean or a continent but shows as blocks when zoomed in on a harbour.
* **Lakes have no depth.** A lake reads at the height of its surface, so it shows as flat ground at that height.
An elevation layer has no regions, so it shows no tooltip and no [chart](/canvases/#visualizations) reads it.
# Tilegram
> Show each region as hexagons in proportion to its value, such as residents, so the map shows where the people are rather than where the land is
A tilegram is a map made of hexagons. Each region gets a number of tiles in proportion to one of its values, and the tiles are laid out roughly where the region is. A region with twice the residents covers twice the tiles, however small it is on an ordinary map.
It is the chart to reach for when the size of a region gets in the way of what your data says. On a choropleth of residents, large and empty regions take most of the map, and the cities where most people live are a few small patches. A tilegram turns that around: the cities grow, the empty regions shrink, and every tile stands for the same number of people.
## How Geografica Builds One
[Section titled “How Geografica Builds One”](#how-geografica-builds-one)
Geografica lays out the tiles for you, on the server, from your data and the boundaries of the [world regions](/world-regions/):
1. **Resize the regions.** The regions are stretched and squeezed, keeping neighbours joined, until each one’s area is its share of the total value. A map reshaped this way is a [cartogram](https://en.wikipedia.org/wiki/Cartogram).
2. **Lay hexagons over them.** A grid of hexagons covers the reshaped map, and each hexagon goes to the region under its centre.
3. **Balance the tiles.** Hexagons on the borders move between neighbouring regions until every region holds exactly its share of the tiles.
Every region with a value gets at least one tile, so a small region never disappears. The chart says what one tile stands for, such as “one tile stands for about 45K”.
The first time a tilegram is shown it can take a few seconds to lay out. After that it is kept, and it is laid out again only when the data changes.
## Add a Tilegram to a Canvas
[Section titled “Add a Tilegram to a Canvas”](#add-a-tilegram-to-a-canvas)
A tilegram is a chart of a canvas, drawn next to the map, and it reads one of the canvas layers. The layer must read a table of values by [world region](/world-regions/), and be coloured by a numeric column, such as population.
1. Open the canvas on [geografica.app](https://geografica.app) and press **Edit**.
2. In the **Visualizations** tab, press **Tilegram**.
3. Pick the **Layer** the tiles read. The tiles are sized and coloured by the column that layer is coloured by, with its palette, so the tilegram and the map match.
4. Pick the number of **Tiles**. A few hundred suits a country divided into a few dozen regions. More tiles follow the values more closely, but each tile is smaller.
5. Save the canvas.
The tilegram shows the regions of the deepest level your data holds, so a dataset with a row for the whole country and rows for its provinces shows the provinces. A region with no value, or a value of zero or less, gets no tiles.
## Tiles by Density
[Section titled “Tiles by Density”](#tiles-by-density)
A tilegram of a count, such as residents, gives the tiles to the regions with the most people. To give them to the most crowded regions instead, show the count per km²: in the **Layers** tab, tick **Per km²** on the layer. The map, its legend and tooltips, and every chart reading the layer then show the value divided by the area of each region, residents per km² for a count of residents.
**Per km²** is offered for data joined to [world regions](/world-regions/), which carry their area.
## Over Time
[Section titled “Over Time”](#over-time)
When the data has a time column, the canvas shows a timeline, and the tilegram follows it: each period is laid out on its own, so a region that grows gains tiles. The tiles can move between periods.
## Limits
[Section titled “Limits”](#limits)
* A tilegram lays out at most 500 regions.
* It reads a table of values by region. A dataset with its own points, lines or shapes has no regions to resize.
* Between 20 and 2000 tiles.
## Other Tilegram Tools
[Section titled “Other Tilegram Tools”](#other-tilegram-tools)
To make a tilegram outside Geografica, or to start from a layout drawn by hand, these free tools are worth a look:
| Tool | What it does |
| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Tilegrams](https://pitchinteractiveinc.github.io/tilegrams/) | Builds hexagon tilegrams in the browser from a cartogram of your data, lets you adjust the tiles by hand, and exports TopoJSON or SVG. Comes with base maps of the United States and Germany. |
| [HexMap Builder](https://odileeds.github.io/hexmaps/builder.html) | From Open Innovations: reads a CSV, places one hexagon per area, lets you move them around, and saves the layout as HexJSON. It already knows the layouts of UK Parliamentary constituencies, NUTS 3 regions and local authorities. |
| [oi.hexmap.js](https://open-innovations.github.io/oi.hexmap.js/) | The Open Innovations library that draws HexJSON hex maps in a web page. |
| [go-cart.io](https://go-cart.io/) | Builds the cartogram itself, the first step of a tilegram, with the regions resized but no hexagons. |
For more free map tools, see [Map Tools](/tools/).
# Canvases
> Create, edit, publish and embed Geografica canvases, saved maps made of layers over your datasets, with charts and tooltips
A **canvas** is a saved map on [Geografica](https://geografica.app). It holds everything needed to draw your data: the layers, the maps and charts drawn from them, where each map opens, how they are laid out and the tooltips shown over them. Open a canvas and it is drawn exactly as it was saved, on Geografica or on any website embedding it.
## Canvas Layers
[Section titled “Canvas Layers”](#canvas-layers)
A canvas is made of layers, drawn bottom to top. Each layer reads a dataset of your organization, and how it is drawn follows from the dataset:
| Layer | Draws | Dataset |
| ---------------------------------------- | ---------------------------------------------------- | --------------------------- |
| [Choropleth](/canvas-layers/choropleth/) | [World regions](/world-regions/) coloured by a value | A table of values by region |
| Fill | The polygons of the dataset, filled | Geographic, polygons |
| Line | The lines of the dataset | Geographic, lines |
| Circle | The points of the dataset, drawn as circles | Geographic, points |
On top of these, a canvas can draw the **region boundaries**, the outlines of countries and their subdivisions, under every other layer, and [elevation](/canvas-layers/elevation/) layers, a range of heights or sea depths shaded or drawn as elevation lines, which need no dataset.
## Create a Canvas
[Section titled “Create a Canvas”](#create-a-canvas)
A canvas starts from a dataset:
1. Sign in to [geografica.app](https://geografica.app) and open the dataset from the **Datasets** page of your organization.
2. Press **Create canvas**. The button shows on datasets Geografica can draw on a map.
3. Fill in the form:
* **Name**, unique within your organization. It starts as the name of the dataset.
* **Description**, optional.
* **Colour by**, the column the layer is coloured by, or *No column, flat colour*.
* **Public canvas**, to publish it straight away. It can be changed later, see [Publish a Canvas](#publish-a-canvas).
4. Press **Create**. The canvas opens with one layer over the dataset, and shows in the **Canvases** page of your organization.
The form does not ask for the layer kind, since the dataset decides it: a table of values by region makes a choropleth, a geographic dataset draws its own geometry.
## Edit a Canvas
[Section titled “Edit a Canvas”](#edit-a-canvas)
Open the canvas and press **Edit**. The edit page shows the canvas beside the forms, split into tabs. Nothing is saved until you press **Save**: the page lists every change against the saved canvas first, and a tab holding unsaved changes is marked.
### Details
[Section titled “Details”](#details)
The **Name** and the **Description** of the canvas.
### Frame
[Section titled “Frame”](#frame)
* **Shape**: the width to height of the canvas, from 16:9 widescreen to 9:16 tall. An embed keeps this shape, and so does a canvas showing a single map and nothing else. A map laid out with charts takes the shape of its tile.
* **Opens at**: when the layers hold more than one period, the period the canvas opens at. Viewers can move to any other period.
### Layers
[Section titled “Layers”](#layers)
Each layer can be shown or hidden when the canvas opens, and a layer over a dataset sets its colours and its tooltip.
**Colour**:
* **Colour by**: the column the regions or features are coloured by, or a flat colour.
* **Per km²**: divides each value by the area of its region, to show a count as a density.
* **Scale**: how the values spread over the colours: quantile, linear, square root or log.
* **Midpoint**: centres the palette on a value, as a diverging palette expects.
* **Palette**: a colour scheme from the [d3 colour schemes](https://d3js.org/d3-scale-chromatic), many of them from [ColorBrewer](https://colorbrewer2.org/), and whether its colours run reversed. Distinct hues suit a column of categories and a ramp a column of magnitudes.
**Tooltip**: whether it shows, whether it follows the pointer or opens on a click, the column that heads it and the columns it lists. Each column takes a label and a format, such as a number, a percentage, a currency, a compact amount such as €18T, a date, a picture or a link built from the value. A number can be multiplied first, for a column stored in thousands or millions. A column can also be marked so a viewer clicks it in the tooltip to colour the map by it.
Press **Region boundaries** to add the outlines of countries and their subdivisions under the other layers, and **Elevation** to add an [elevation](/canvas-layers/elevation/) layer, which sets the range of heights it keeps and whether it shades them or draws their elevation lines.
### Visualizations
[Section titled “Visualizations”](#visualizations)
The maps and the charts the canvas draws. A canvas can hold several maps, each drawing every layer on the same timeline:
* **Map**: opens where you leave it, so move and zoom it to the view it should open at. Its **Projection** is a flat map, or a globe that flattens as viewers zoom in. **Lock zoom out** keeps viewers from zooming out past the view it opens at, or panning outside it; the editor stays free, so you can still reframe it. On a globe viewers can still spin the world. **Basemap buttons** adds a button for satellite imagery, terrain or both, so viewers can switch the map from its streets; a map shows none unless they are ticked.
The charts each read one layer of the canvas, so a chart and the maps always show the same numbers in the same colours:
* **Bar**: the regions ranked by value at the current period, the top ones highest or lowest first, at one level or at every level together. **Plots** picks the column the bars rank by, the one the map is coloured by or any other number of the dataset, and the bars keep the colours of the map.
* **Time series**: the value over every period, one line per region. Click a region on any map to add it to the chart, and click it again to take it off.
* **[Tilegram](/canvas-layers/tilegram/)**: each region as hexagons in proportion to its value.
The maps and the charts are tiles in the preview. Drag a tile by its title bar to move it, and drag its edge or its corner to resize it. The published canvas and its embed show the same layout, narrowed to fit a smaller screen.
### Tooltips
[Section titled “Tooltips”](#tooltips)
How every tooltip of the canvas looks: following the viewer’s light or dark mode, always light, always dark, the brand accent, or your own background and text colours.
### Settings
[Section titled “Settings”](#settings)
Publish the canvas, or delete it.
## Publish a Canvas
[Section titled “Publish a Canvas”](#publish-a-canvas)
A canvas is private to your organization until you publish it, in the **Settings** tab of the edit page or when you create it. A public canvas can be read by anyone holding its address, without signing in, and listed with the other [public canvases](https://geografica.app/canvases).
Publishing a canvas does not publish the datasets it reads, which have a setting of their own. A layer over a dataset which is not public shows nothing to the public, so publish the datasets too.
## Embed a Canvas
[Section titled “Embed a Canvas”](#embed-a-canvas)
A public canvas can be put on any website, as on the [Choropleth Map](/canvas-layers/choropleth/) page:
1. Open the canvas on [geografica.app](https://geografica.app) and press **Embed**. Anyone reading a public canvas can embed it, not only its organization.
2. Optionally set a **Height in pixels**, between 200 and 2000.
3. Press **Copy** and paste the code into your page. **Preview** opens the embedded map on its own.
The code is an [`iframe`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe), so there is nothing to install:
```html
```
* Without a height the frame keeps the shape of the canvas at any width. A height fits a fixed slot instead, cropping or widening the map.
* The embed shows the canvas as it is saved, so later changes reach every page embedding it.
* A layer over a dataset which is not public is empty in the embed, and the **Embed** dialog names those layers.
* A canvas that is made private or deleted shows *This canvas is not published* in every page embedding it.
## Delete a Canvas
[Section titled “Delete a Canvas”](#delete-a-canvas)
Press **Delete canvas** in the **Settings** tab and confirm. The canvas is removed for everyone and every page embedding it stops showing the map. This cannot be undone. Deleting a canvas does not delete its datasets.
## Canvases Through the API
[Section titled “Canvases Through the API”](#canvases-through-the-api)
Canvases can also be created, read, updated and deleted from code, with an API key of your organization. See the canvas operations in the [API documentation](https://api.geografica.app/v1/docs) and the [OpenAPI specification](https://api.geografica.app/v1/openapi.json). Public canvases are read through the public operations, without a key.
# Map Tools
> A curated list of websites with free tools for working with maps and geographic data
A curated list of websites with free tools we find useful when preparing data and designing maps. Each entry says what the tool is for, so you can pick the right one for the job.
## Cartograms
[Section titled “Cartograms”](#cartograms)
| Tool | What it does |
| ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [go-cart.io](https://go-cart.io/) | Builds contiguous cartograms, maps whose regions are resized in proportion to a value such as population, using the fast flow based algorithm of Gastner, Seguy and More (2018). |
| [Tilegrams](https://pitchinteractiveinc.github.io/tilegrams/) | Builds hexagon tile cartograms, one or more tiles per region sized by a value, and exports them as TopoJSON or SVG. |
| [Worldmapper](https://worldmapper.org/) | A library of ready made world cartograms, countries resized by a value such as population, income or emissions, free to view and download. |
## Boundaries and Geometry
[Section titled “Boundaries and Geometry”](#boundaries-and-geometry)
| Tool | What it does |
| ----------------------------------- | ------------------------------------------------------------------------------------ |
| [mapshaper](https://mapshaper.org/) | Edits, simplifies and converts Shapefile, GeoJSON and TopoJSON files in the browser. |
| [geojson.io](https://geojson.io/) | Draws and edits GeoJSON on a map, handy for checking or sketching a small file. |
## Colour
[Section titled “Colour”](#colour)
| Tool | What it does |
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| [ColorBrewer](https://colorbrewer2.org/) | Sequential, diverging and qualitative colour schemes designed for maps, with guidance on colour blind safety and printing. |
## Map Data
[Section titled “Map Data”](#map-data)
| Tool | What it does |
| -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| [geoBoundaries](https://www.geoboundaries.org/) | Openly licensed administrative boundaries for every country, from national borders down to local subdivisions. |
| [Natural Earth](https://www.naturalearthdata.com/) | Public domain world map data, such as countries, coastlines and rivers, at several scales. |
# World Regions
> The world regions Geografica provides, from countries down to municipalities, how their levels nest, and the ISO, NUTS and national codes they carry
The **[world regions](https://geografica.app/world-regions)** are the map Geografica provides for the whole world: every country, and inside each country its regions, provinces, districts and municipalities, each with its boundary and its codes. Geografica keeps them up to date, so you never have to find, clean or upload a boundary file.
Your data [joins onto them](#joining-your-data). A table of values by country or by region is drawn on the boundaries of the world regions it names, in a [canvas](/canvases/), as a [choropleth](/canvas-layers/choropleth/) or a [tilegram](/canvas-layers/tilegram/).
Browse them on [geografica.app/world-regions](https://geografica.app/world-regions), or read them through the [API](#world-regions-through-the-api).
## Levels
[Section titled “Levels”](#levels)
Every world region sits at a **level**, its depth below the country:
* **Level 0** is the country.
* **Level 1** is the first division of the country, level 2 the division below it, and so on, down to level 4.
Each region names its **parent**, the region one level up that contains it, so the regions of a country form a tree. Agliè, a comune of Piedmont, sits in a chain of five regions, one at each level:
| Level | Code | Name | Type |
| ----- | ----------- | ---------- | ------------ |
| 0 | `IT` | Italy | country |
| 1 | `ITC` | Nord-Ovest | other |
| 2 | `IT-21` | Piemonte | region |
| 3 | `IT-TO` | Torino | province |
| 4 | `IT-001001` | Agliè | municipality |
The levels follow the divisions each country actually has, so the same level holds different kinds of region in different countries:
| Country | Level 1 | Level 2 | Level 3 | Level 4 |
| -------------- | ------------------------ | ----------------------------------------------------------------------------------------- | ------------ | --------- |
| Italy | NUTS 1 groups of regions | regioni | province | comuni |
| Germany | Länder | NUTS 2 regions | Kreise | Gemeinden |
| France | régions | former régions and overseas collectivities, the NUTS 2 regions | départements | communes |
| United Kingdom | nations | counties, unitary authorities, boroughs, Scottish council areas, Northern Irish districts | districts | wards |
| United States | states | counties | | |
The **type** of a region names what it is in its country: `state`, `county`, `region`, `province`, `department`, `district`, `ward`, `municipality`, or `other` when the division has no common name.
### European Countries
[Section titled “European Countries”](#european-countries)
In the countries [Eurostat](https://ec.europa.eu/eurostat) covers with [NUTS](https://ec.europa.eu/eurostat/web/nuts), the EU members and the candidate countries, levels 1 to 3 are the NUTS levels 1 to 3, and level 4 is the municipalities, the [local administrative units](https://ec.europa.eu/eurostat/web/nuts/local-administrative-units). This makes a level comparable across Europe: level 3 is NUTS 3 in Italy, in Germany and in France alike. Each region carries its NUTS codes among its [other codes](#other-codes).
### Regions Covering More Than One Level
[Section titled “Regions Covering More Than One Level”](#regions-covering-more-than-one-level)
Where a division is the only one under its parent, it covers the same area as the parent, and it is one region covering both levels rather than two copies. Its **level** is the first it covers and its **last level** the last:
* Corse covers levels 1 and 2 of France.
* Brandenburg covers levels 1 and 2 of Germany.
* Valle d’Aosta covers levels 2 and 3 of Italy.
* Cumberland covers levels 2 and 3 of the United Kingdom.
The regions below it start at the level after its last, so every level still covers the whole country.
## Codes
[Section titled “Codes”](#codes)
### The Region Code
[Section titled “The Region Code”](#the-region-code)
Every world region has a **code**, unique across the world, which is the key [your data joins on](#joining-your-data):
* A country is coded by its [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 code: `IT`, `GB`, `US`.
* A region with an [ISO 3166-2](https://www.iso.org/standard/72483.html) code is coded by it: `IT-21` for Piemonte, `GB-ENG` for England, `US-CA` for California. You can look any code up on the [ISO Online Browsing Platform](https://www.iso.org/obp/ui/).
* Any other region is coded by the country followed by an official code of the region: `ITC` for Nord-Ovest, its NUTS code, `IT-001001` for Agliè, its ISTAT code, `US-01001` for Autauga County, its FIPS code.
* A region with no official code is coded by its parent and its name: `MX-GUADALAJARA`.
Treat the code as an identifier: compare it, store it and join on it, but do not build it from parts or parse it, since its shape depends on the country and the level.
### ISO Codes
[Section titled “ISO Codes”](#iso-codes)
Next to its code, a region carries its **ISO** code, the ISO 3166-1 code of a country or the ISO 3166-2 code of a subdivision, and nothing when ISO does not code it. A country also carries its ISO 3166-1 alpha-3 code, `ITA` for Italy.
ISO codes the divisions each country declares to it, which are not always the divisions the country uses for its statistics. So a region may carry an ISO code at level 2 in one country and at level 3 in another: the Italian regioni are level 2 and the provinces level 3, as the [levels](#levels) table shows.
### Other Codes
[Section titled “Other Codes”](#other-codes)
A region also carries the other codes it is known by, each under the name of its scheme. These are the codes national statistics and Eurostat publish data by, so a table using them joins without a lookup of your own:
| Scheme | Code | Example |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------- |
| `nuts0` to `nuts3` | [Eurostat NUTS](https://ec.europa.eu/eurostat/web/nuts) code at that NUTS level | Torino is `ITC11` under `nuts3` |
| `lau` | [Eurostat local administrative unit](https://ec.europa.eu/eurostat/web/nuts/local-administrative-units), the code of a municipality | Albersdorf is `01051001` |
| `belfiore` | Italian [cadastral code](https://it.wikipedia.org/wiki/Codice_catastale) of a comune, used in the Italian tax code | Agliè is `A074` |
| `gss` | UK [GSS code](https://www.ons.gov.uk/methodology/geography/ukgeographies/administrativegeography) of the [Office for National Statistics](https://www.ons.gov.uk/) | England is `E92000001`, Aberdeenshire `S12000034` |
| `fips` | US [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) of the [Census Bureau](https://www.census.gov/) | Autauga County is `01001` |
| `iso_replaced` | The ISO 3166-2 code of a region that was replaced, kept on the regions that replaced it | Cumberland carries `GB-CMA`, the former Cumbria |
The NUTS regions covering a region are also listed, with their level and name, when you read a single region.
## Other Details
[Section titled “Other Details”](#other-details)
Each world region also carries:
| Field | What it holds |
| ------------------------ | ---------------------------------------------------------------------------------------------------- |
| `name` | The name in the national language, such as Piemonte |
| `full_name` | The full English name of a country, such as Italian Republic |
| `country` | The ISO 3166-1 alpha-2 code of its country |
| `continent` | The [UN M49](https://unstats.un.org/unsd/methodology/m49/) region of its country |
| `flag` | A link to its flag, when it has one |
| `area_km2` | The area of its boundary in km², which the [Per km²](/canvases/#layers) option of a layer divides by |
| `bbox` | The box its boundary fits in, west, south, east and north |
| `source` | Where its boundary comes from |
| `license` | The licence the boundary is published under |
| `year` | The year the boundary represents |
| `start_date`, `end_date` | When this version of the region starts and ends, for regions that changed |
The boundaries come from the official publishers wherever they publish them: [Eurostat GISCO](https://ec.europa.eu/eurostat/web/gisco) for Europe, [ISTAT](https://www.istat.it/) for the Italian comuni, the [Office for National Statistics](https://geoportal.statistics.gov.uk/) for the United Kingdom, the [US Census Bureau](https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html) for the United States, and [geoBoundaries](https://www.geoboundaries.org/) for the rest of the world. The `source`, `license` and `year` of each region say which one, so you can credit it. For more free boundary data and tools, see [Map Tools](/tools/).
## Joining Your Data
[Section titled “Joining Your Data”](#joining-your-data)
When you upload a table, Geografica looks for a column naming world regions. A column joins when at least 80% of its values match a region, by:
* the ISO 3166-1 code or the name of a country, such as `IT` or `Italy`
* the ISO 3166-2 code of a region, such as `CA-ON` for Ontario
A column can mix both, so one table can hold countries and regions together. When the dataset names its country, a value can also be one of the [other codes](#other-codes) of a region of that country, such as the GSS code `S12000034` for Aberdeenshire.
Each row then belongs to its world region, and is drawn on its boundary. Press **Create canvas** on the dataset to see it on a map, as described in [Create a Canvas](/canvases/#create-a-canvas): a table joined to the world regions starts as a [choropleth](/canvas-layers/choropleth/), and can also be shown as a [tilegram](/canvas-layers/tilegram/).
## World Regions Through the API
[Section titled “World Regions Through the API”](#world-regions-through-the-api)
The world regions are public, so these operations need no API key:
| Operation | Returns |
| --------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `GET /v1/world-regions` | The world regions, filtered by `country`, `level`, `parent`, `continent`, `code` or a `search` on the name |
| `GET /v1/world-regions/{code}` | One region, with the NUTS regions covering it |
| `GET /v1/tiles/world-regions/{z}/{x}/{y}.pbf` | The boundaries as vector tiles, for drawing them on a map, as [canvases](/canvases/) do |
For example, the provinces of Piedmont:
```bash
curl "https://api.geografica.app/v1/world-regions?parent=IT-21"
```
See the [API documentation](https://api.geografica.app/v1/docs) and the [OpenAPI specification](https://api.geografica.app/v1/openapi.json) for every parameter and field.