---
title: "Choropleth World Map Image API — Sales & data by country | Imejis"
description: "Generate choropleth world-map images — countries shaded by value with a legend — for sales-by-country, coverage and geographic dashboards. Fresh data on every API call. Start free with Imejis."
url: "https://www.imejis.io/components/map"
---

# Choropleth World Map Image API — Sales & data by country | Imejis

A choropleth world map — countries shaded by value on a color scale, with an optional legend. Key your data by ISO-3166 code (or country name) and swap it on every API call to build sales-by-country, coverage and geographic dashboards straight into an image.

## Use cases

- Sales / revenue / users by country dashboards
- Coverage and availability maps (where a product ships or works)
- Survey, election or sentiment results by country
- Growth / change maps with a diverging red→green scale
- Year-in-review and report graphics with a geographic breakdown

## Authoring notes

- data is [{ id, value }] — id is an ISO-3166 alpha-2 ("US") or alpha-3 ("USA") code, or the country name; countries with no row render in emptyColor.
- Use a wide box (~2:1) so the world fits without large empty margins; the map letterboxes to the box while keeping its aspect ratio.
- Switch colorMode to "diverging" for signed data (growth, change) — positive values use positiveColor, negative use negativeColor.
- Set scaleMax to pin the top of the color scale (e.g. a fixed 100%); leave 0 to auto-fit the data range.
- Provide colors[] (lightest→darkest) to control the exact ramp, or set baseColor for a single-hue ramp.
- Set basemap to 'us-states' for a US map (data keyed by state code like 'CA' or name); it is drawn in Albers-USA with Alaska & Hawaii as insets, so the projection setting does not apply.
- Beyond the US, 'canada-provinces', 'germany-states', 'australia-states', 'brazil-states' and 'india-states' draw province/state choropleths — key data by the local region code (e.g. 'ON', 'BY'), ISO-3166-2 (e.g. 'CA-ON') or the region name; these ship pre-projected, so the projection setting does not apply.
- Set mode to 'bubble' for a proportional-symbol map: regions draw in emptyColor and a circle sized by value (area-proportional) sits at each region's center, filled with bubbleColor. Use it when a count matters more than a shade.
- Set colorMode to 'categorical' and add a 'category' to each data row to color by group (e.g. sales region) instead of a number — colors[] is the palette, or a built-in one is used, and the legend lists the categories.
- Turn on showLabels to print each region's value (or set labelField to 'name') right on the map; labels are drawn inside the SVG with a white halo, so they survive PNG/SVG export.

## Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `data` | `object[]` | `[]` | Regions: array of { id, value, label? } — id is an ISO-3166 code or name. |
| `basemap` | `'world' \| 'us-states' \| 'canada-provinces' \| 'germany-states' \| 'australia-states' \| 'brazil-states' \| 'india-states'` | `"world"` | Which bundled basemap to draw: 'world' countries, 'us-states', 'canada-provinces', 'germany-states', 'australia-states', 'brazil-states' or 'india-states'. |
| `mode` | `'choropleth' \| 'bubble'` | `"choropleth"` | 'choropleth' shades regions by value; 'bubble' draws a flat map with a proportional circle at each region's center. |
| `projection` | `'equirectangular' \| 'mercator'` | `"equirectangular"` | Map projection: 'equirectangular' (flat) or 'mercator'. |
| `matchBy` | `'auto' \| 'iso2' \| 'iso3' \| 'name'` | `"auto"` | How a row's id joins to a region: 'auto', 'iso2', 'iso3' or 'name'. |
| `colorMode` | `'ramp' \| 'diverging' \| 'categorical'` | `"ramp"` | 'ramp' shades by intensity in one hue; 'diverging' colors +/− values; 'categorical' colors by each row's category. |
| `colors` | `color[]` | `[]` | Ramp swatches (lightest→darkest); also the palette for categorical mode. |
| `baseColor` | `color` | `"#2563eb"` | Ramp hue used when no swatches are given. |
| `emptyColor` | `color` | `"#e5e7eb"` | Fill for regions with no matching data value. |
| `positiveColor` | `color` | `"#16a34a"` | Positive color in diverging mode. |
| `negativeColor` | `color` | `"#dc2626"` | Negative color in diverging mode. |
| `scaleMax` | `number` | `0` | Value mapped to the most saturated color (0 = auto from the data). |
| `levels` | `number` (min 1) | `5` | Number of intensity buckets in ramp mode. |
| `strokeColor` | `color` | `"#ffffff"` | Color of region borders. |
| `strokeWidth` | `number` (min 0) | `0.5` | Width of region borders (px). |
| `bubbleColor` | `color` | `"#2563eb"` | Fill for the proportional bubbles in bubble mode. |
| `bubbleSize` | `number` (min 0) | `1` | Bubble size multiplier in bubble mode (1 = default). |
| `showLabels` | `boolean` | `false` | Draw a label on each region that has data (value or name). |
| `labelField` | `'value' \| 'name'` | `"value"` | What each region label shows: 'value' or the region 'name'. |
| `labelSize` | `number` (min 0) | `1` | Per-region label size multiplier (1 = default). |
| `showLegend` | `boolean` | `true` | Draw a low→high legend strip. |
| `labelColor` | `color` | `"#64748b"` | Legend + label text color. |
| `opacity` | `number` | `1` | Overall component opacity from 0 (transparent) to 1 (opaque). |
| `borderWidth` | `number` | `0` | Border thickness in pixels around the component. |
| `borderColor` | `color` | `"transparent"` | Border color (any CSS color). |
| `borderStyle` | `'solid' \| 'dashed' \| 'dotted' \| 'double' \| 'none'` | `"solid"` | Border line style. |
| `borderRadius` | `number` | `0` | Corner radius in pixels. |
| `boxShadow` | `string` | — | CSS box-shadow applied to the component, e.g. "0 4px 6px rgba(0,0,0,0.1)". |

## Sample design JSON

```json
{
  "title": "Map sample",
  "description": "A choropleth world map shaded by value",
  "dimensions": {
    "width": 860,
    "height": 460
  },
  "background": {
    "color": "#ffffff"
  },
  "components": [
    {
      "id": "sample-map",
      "key": "map",
      "type": "map",
      "position": {
        "x": 20,
        "y": 20
      },
      "rotation": 0,
      "size": {
        "width": 820,
        "height": 420
      },
      "dynamic": true,
      "properties": {
        "data": [
          {
            "id": "US",
            "value": 920
          },
          {
            "id": "CA",
            "value": 410
          },
          {
            "id": "MX",
            "value": 250
          },
          {
            "id": "BR",
            "value": 300
          },
          {
            "id": "AR",
            "value": 160
          },
          {
            "id": "CL",
            "value": 120
          },
          {
            "id": "CO",
            "value": 140
          },
          {
            "id": "GB",
            "value": 610
          },
          {
            "id": "FR",
            "value": 540
          },
          {
            "id": "DE",
            "value": 700
          },
          {
            "id": "ES",
            "value": 300
          },
          {
            "id": "IT",
            "value": 340
          },
          {
            "id": "PT",
            "value": 130
          },
          {
            "id": "NL",
            "value": 260
          },
          {
            "id": "SE",
            "value": 180
          },
          {
            "id": "NO",
            "value": 150
          },
          {
            "id": "PL",
            "value": 210
          },
          {
            "id": "UA",
            "value": 120
          },
          {
            "id": "RU",
            "value": 480
          },
          {
            "id": "TR",
            "value": 260
          },
          {
            "id": "EG",
            "value": 190
          },
          {
            "id": "ZA",
            "value": 230
          },
          {
            "id": "NG",
            "value": 210
          },
          {
            "id": "KE",
            "value": 110
          },
          {
            "id": "MA",
            "value": 100
          },
          {
            "id": "SA",
            "value": 280
          },
          {
            "id": "AE",
            "value": 240
          },
          {
            "id": "IN",
            "value": 480
          },
          {
            "id": "CN",
            "value": 700
          },
          {
            "id": "JP",
            "value": 560
          },
          {
            "id": "KR",
            "value": 320
          },
          {
            "id": "ID",
            "value": 260
          },
          {
            "id": "TH",
            "value": 180
          },
          {
            "id": "VN",
            "value": 190
          },
          {
            "id": "AU",
            "value": 340
          },
          {
            "id": "NZ",
            "value": 120
          }
        ],
        "basemap": "world",
        "projection": "equirectangular",
        "colorMode": "ramp",
        "baseColor": "#2563eb",
        "emptyColor": "#e5e7eb",
        "showLegend": true,
        "opacity": 1
      }
    }
  ]
}
```

## Examples

### Sales by country

A global sales dashboard shaded in a blue intensity ramp.

API overrides that reproduce this example:

```json
{
  "map.data": [
    {
      "id": "US",
      "value": 920
    },
    {
      "id": "CA",
      "value": 410
    },
    {
      "id": "MX",
      "value": 250
    },
    {
      "id": "BR",
      "value": 300
    },
    {
      "id": "AR",
      "value": 160
    },
    {
      "id": "CL",
      "value": 120
    },
    {
      "id": "CO",
      "value": 140
    },
    {
      "id": "GB",
      "value": 610
    },
    {
      "id": "FR",
      "value": 540
    },
    {
      "id": "DE",
      "value": 700
    },
    {
      "id": "ES",
      "value": 300
    },
    {
      "id": "IT",
      "value": 340
    },
    {
      "id": "PT",
      "value": 130
    },
    {
      "id": "NL",
      "value": 260
    },
    {
      "id": "SE",
      "value": 180
    },
    {
      "id": "NO",
      "value": 150
    },
    {
      "id": "PL",
      "value": 210
    },
    {
      "id": "UA",
      "value": 120
    },
    {
      "id": "RU",
      "value": 480
    },
    {
      "id": "TR",
      "value": 260
    },
    {
      "id": "EG",
      "value": 190
    },
    {
      "id": "ZA",
      "value": 230
    },
    {
      "id": "NG",
      "value": 210
    },
    {
      "id": "KE",
      "value": 110
    },
    {
      "id": "MA",
      "value": 100
    },
    {
      "id": "SA",
      "value": 280
    },
    {
      "id": "AE",
      "value": 240
    },
    {
      "id": "IN",
      "value": 480
    },
    {
      "id": "CN",
      "value": 700
    },
    {
      "id": "JP",
      "value": 560
    },
    {
      "id": "KR",
      "value": 320
    },
    {
      "id": "ID",
      "value": 260
    },
    {
      "id": "TH",
      "value": 180
    },
    {
      "id": "VN",
      "value": 190
    },
    {
      "id": "AU",
      "value": 340
    },
    {
      "id": "NZ",
      "value": 120
    }
  ],
  "map.colorMode": "ramp",
  "map.baseColor": "#2563eb"
}
```

### Users by country (green)

Monthly active users by country in a green ramp with explicit swatches.

API overrides that reproduce this example:

```json
{
  "map.data": [
    {
      "id": "US",
      "value": 736
    },
    {
      "id": "CA",
      "value": 328
    },
    {
      "id": "MX",
      "value": 200
    },
    {
      "id": "BR",
      "value": 240
    },
    {
      "id": "AR",
      "value": 128
    },
    {
      "id": "CL",
      "value": 96
    },
    {
      "id": "CO",
      "value": 112
    },
    {
      "id": "GB",
      "value": 488
    },
    {
      "id": "FR",
      "value": 432
    },
    {
      "id": "DE",
      "value": 560
    },
    {
      "id": "ES",
      "value": 240
    },
    {
      "id": "IT",
      "value": 272
    },
    {
      "id": "PT",
      "value": 104
    },
    {
      "id": "NL",
      "value": 208
    },
    {
      "id": "SE",
      "value": 144
    },
    {
      "id": "NO",
      "value": 120
    },
    {
      "id": "PL",
      "value": 168
    },
    {
      "id": "UA",
      "value": 96
    },
    {
      "id": "RU",
      "value": 384
    },
    {
      "id": "TR",
      "value": 208
    },
    {
      "id": "EG",
      "value": 152
    },
    {
      "id": "ZA",
      "value": 184
    },
    {
      "id": "NG",
      "value": 168
    },
    {
      "id": "KE",
      "value": 88
    },
    {
      "id": "MA",
      "value": 80
    },
    {
      "id": "SA",
      "value": 224
    },
    {
      "id": "AE",
      "value": 192
    },
    {
      "id": "IN",
      "value": 384
    },
    {
      "id": "CN",
      "value": 560
    },
    {
      "id": "JP",
      "value": 448
    },
    {
      "id": "KR",
      "value": 256
    },
    {
      "id": "ID",
      "value": 208
    },
    {
      "id": "TH",
      "value": 144
    },
    {
      "id": "VN",
      "value": 152
    },
    {
      "id": "AU",
      "value": 272
    },
    {
      "id": "NZ",
      "value": 96
    }
  ],
  "map.colorMode": "ramp",
  "map.colors": [
    "#dcfce7",
    "#86efac",
    "#22c55e",
    "#16a34a",
    "#166534"
  ]
}
```

## API overrides

Push fresh regions per render with '<key>.data' (or just '<key>') as [{ id, value }]; id is an ISO-3166 code (US, FRA) or country name, and the map recolors to match.

Flat override payload (`key.property` addressing) with the sample design's current values — send only the keys you want to change:

```json
{
  "map.data": [
    {
      "id": "US",
      "value": 920
    },
    {
      "id": "CA",
      "value": 410
    },
    {
      "id": "MX",
      "value": 250
    },
    {
      "id": "BR",
      "value": 300
    },
    {
      "id": "AR",
      "value": 160
    },
    {
      "id": "CL",
      "value": 120
    },
    {
      "id": "CO",
      "value": 140
    },
    {
      "id": "GB",
      "value": 610
    },
    {
      "id": "FR",
      "value": 540
    },
    {
      "id": "DE",
      "value": 700
    },
    {
      "id": "ES",
      "value": 300
    },
    {
      "id": "IT",
      "value": 340
    },
    {
      "id": "PT",
      "value": 130
    },
    {
      "id": "NL",
      "value": 260
    },
    {
      "id": "SE",
      "value": 180
    },
    {
      "id": "NO",
      "value": 150
    },
    {
      "id": "PL",
      "value": 210
    },
    {
      "id": "UA",
      "value": 120
    },
    {
      "id": "RU",
      "value": 480
    },
    {
      "id": "TR",
      "value": 260
    },
    {
      "id": "EG",
      "value": 190
    },
    {
      "id": "ZA",
      "value": 230
    },
    {
      "id": "NG",
      "value": 210
    },
    {
      "id": "KE",
      "value": 110
    },
    {
      "id": "MA",
      "value": 100
    },
    {
      "id": "SA",
      "value": 280
    },
    {
      "id": "AE",
      "value": 240
    },
    {
      "id": "IN",
      "value": 480
    },
    {
      "id": "CN",
      "value": 700
    },
    {
      "id": "JP",
      "value": 560
    },
    {
      "id": "KR",
      "value": 320
    },
    {
      "id": "ID",
      "value": 260
    },
    {
      "id": "TH",
      "value": 180
    },
    {
      "id": "VN",
      "value": 190
    },
    {
      "id": "AU",
      "value": 340
    },
    {
      "id": "NZ",
      "value": 120
    }
  ],
  "map.basemap": "world",
  "map.projection": "equirectangular",
  "map.colorMode": "ramp",
  "map.baseColor": "#2563eb",
  "map.emptyColor": "#e5e7eb",
  "map.showLegend": true,
  "map.opacity": 1
}
```

```bash
curl --location 'https://render.imejis.io/v1/{{YOUR_DESIGN_ID}}' \
--header 'dma-api-key: {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
    "map.data": [
        {
            "id": "US",
            "value": 920
        },
        {
            "id": "CA",
            "value": 410
        },
        {
            "id": "MX",
            "value": 250
        },
        {
            "id": "BR",
            "value": 300
        },
        {
            "id": "AR",
            "value": 160
        },
        {
            "id": "CL",
            "value": 120
        },
        {
            "id": "CO",
            "value": 140
        },
        {
            "id": "GB",
            "value": 610
        },
        {
            "id": "FR",
            "value": 540
        },
        {
            "id": "DE",
            "value": 700
        },
        {
            "id": "ES",
            "value": 300
        },
        {
            "id": "IT",
            "value": 340
        },
        {
            "id": "PT",
            "value": 130
        },
        {
            "id": "NL",
            "value": 260
        },
        {
            "id": "SE",
            "value": 180
        },
        {
            "id": "NO",
            "value": 150
        },
        {
            "id": "PL",
            "value": 210
        },
        {
            "id": "UA",
            "value": 120
        },
        {
            "id": "RU",
            "value": 480
        },
        {
            "id": "TR",
            "value": 260
        },
        {
            "id": "EG",
            "value": 190
        },
        {
            "id": "ZA",
            "value": 230
        },
        {
            "id": "NG",
            "value": 210
        },
        {
            "id": "KE",
            "value": 110
        },
        {
            "id": "MA",
            "value": 100
        },
        {
            "id": "SA",
            "value": 280
        },
        {
            "id": "AE",
            "value": 240
        },
        {
            "id": "IN",
            "value": 480
        },
        {
            "id": "CN",
            "value": 700
        },
        {
            "id": "JP",
            "value": 560
        },
        {
            "id": "KR",
            "value": 320
        },
        {
            "id": "ID",
            "value": 260
        },
        {
            "id": "TH",
            "value": 180
        },
        {
            "id": "VN",
            "value": 190
        },
        {
            "id": "AU",
            "value": 340
        },
        {
            "id": "NZ",
            "value": 120
        }
    ],
    "map.basemap": "world",
    "map.projection": "equirectangular",
    "map.colorMode": "ramp",
    "map.baseColor": "#2563eb",
    "map.emptyColor": "#e5e7eb",
    "map.showLegend": true,
    "map.opacity": 1
}'
```

`{{YOUR_DESIGN_ID}}` and `{{YOUR_API_KEY}}` are placeholders: first create
the design in your account (paste the sample design JSON above into the
editor at https://app.imejis.io, or create it programmatically via the
imejis MCP server's `create_design` + `update_design` tools), then render
it with the design's id and one of your API keys.

Agents: the MCP server at https://api.imejis.io/api/mcp exposes this same
catalog as structured data via the `list_component_types` tool (property
kinds, allowed values, bounds, ready-to-use sample designs).

## Frequently Asked Questions

### How do I pass the country values?

Send '<key>.data' as an array of { id, value } objects — id is an ISO-3166 alpha-2 code (US), alpha-3 code (USA) or the country name. Each country is shaded by its value; countries with no row render in emptyColor.

### Which regions are supported?

Seven basemaps: 'world' covers every sovereign country (keyed by ISO-3166 code or name), and admin-1 sets cover 'us-states', 'canada-provinces', 'germany-states', 'australia-states', 'brazil-states' and 'india-states' (keyed by the local region code, ISO-3166-2 like 'CA-ON', or region name). Set the basemap property to switch.

### Can I show negative values, like growth or change?

Yes — set colorMode to "diverging" and positive values shade toward positiveColor, negatives toward negativeColor, with a neutral middle. Great for GDP growth, net change or over/under-target maps.

### Can I fix the color scale across renders?

Set scaleMax to the value that should map to the darkest color (e.g. 100 for a percentage). Leave it 0 and the scale auto-fits each render’s data range.

## Variants

- [Diverging](https://www.imejis.io/components/map/diverging.md) — Signed values on a diverging red→green scale — for growth and change.
- [Dark](https://www.imejis.io/components/map/dark.md) — A choropleth on a dark card with a bright ramp — built for social.
- [US states](https://www.imejis.io/components/map/us-states.md) — A US state choropleth (Albers-USA, Alaska & Hawaii as insets).
- [Country regions](https://www.imejis.io/components/map/country-regions.md) — Province / state choropleths for Canada, Germany, Australia, Brazil and India.
- [Bubble](https://www.imejis.io/components/map/bubble.md) — Proportional-symbol map — a circle at each region sized by value, on a flat basemap.
- [Categorical](https://www.imejis.io/components/map/categorical.md) — Color regions by a category (not a number) — for groupings like sales regions.

All components: https://www.imejis.io/components.md
