Getting started
Your first map¶
From a GeoDataFrame to a finished, titled map in four steps.
The examples on this site use Sudan's 18 states with their 2008 census population, which ships with kharita's repository in data/processed/sudan_states.gpkg. It has the columns key, pop, area_km2 and density.
import geopandas as gpd
import kharita as kh
states = gpd.read_file("data/processed/sudan_states.gpkg")
1. One colour¶
A style string is a list of utilities separated by spaces. Colours are Tailwind names with an optional opacity after a slash.
2. Colour by data¶
Put a column in brackets. kharita classifies it, here into five quantile classes, colours each class from a ramp and writes the legend with the count in each class.
3. A theme and a ratio¶
theme-paper swaps the basemap for a warm print style and puts place names above your data. Brackets also take a ratio of two columns.
4. Title, subtitle and source¶
Text goes in keyword arguments, not the style string.
Share it¶
m = kh.map(states, "theme-paper fill-[density] ramp-ylorrd scheme-q5", title="Population density")
m.to_html("density.html")
Next: Core concepts explains how styles, layers and maps fit together.



