Skip to content

Choropleth Map

ChoroplethMapChartStrategy renders country-level data on an interactive world map using ISO 3166-1 alpha-2 country codes. No Mapbox token is required.

Constructor

from orama.strategies.choropleth_map import ChoroplethMapChartStrategy
from orama.enums import GeoProjection
from orama.variables import Aggregation

strategy = ChoroplethMapChartStrategy(
    fields_metadata=fields_metadata,
    country_variable="country_code",    # str — CountryCodeVariable (ISO 3166-1 alpha-2)
    aggregation=Aggregation(name="count", function="count"),
    map_style=GeoProjection.EQUIRECTANGULAR,  # GeoProjection enum
    fit_bounds=False,                   # bool — auto-zoom to countries with data
    color_rules=None,
    title=None,                         # str | None
    subtitle=None,                      # str | None
    caption=None,                       # str | None
    description=None,                   # str | None — interpretive text (not in figure)
    storytelling_context=None,          # str | None — narrative goal / target audience
    country_label=None,                 # str | None — label for the country dimension
    value_label=None,                   # str | None — colorbar title
    show_colorbar=True,                 # bool — show the colorbar (continuous color mode only)
)

get_query_params() returns a single "main" key.

Map projections

See GeoProjection for all available projections.

Supported colors

Selectors: ColorSelectorStrategy, ColorSelectByCategoryName, ColorSelectValuesBelow, ColorSelectValuesAbove, ColorSelectMaxValue, ColorSelectMinValue, ColorSelectValuesBelowMean, ColorSelectValuesAboveMean.

Assigners: ColorAssignerByCategory, ColorAssignerByValue.