Skip to content

Reference

API

Every public function, generated from the code.

kh.bind

kh.bind(data, style, colors=None, order=None)

Compile a style against a table; colors and order fix category colours and their order.

kh.check_ramp

kh.check_ramp(name, classes=5)

Lightness steps and colour-blind safety of a ramp, at the given number of classes.

kh.colors

kh.colors(family=None)

Every Tailwind shade kharita knows, one family per row, with each shade's number.

kh.compare

kh.compare(*maps, link=True)

Two or more kharita maps side by side; with link, they pan and zoom together.

kh.contours

kh.contours(where, interval=None, zoom=None, index_every=5, detail='medium', smooth=None, below_sea=False)

Contour lines over an area: a GeoDataFrame with elevation, index and weight columns.

where is a GeoDataFrame, GeoSeries or (west, south, east, north). Every index_every-th line is an index contour (weight 2, the rest 1), the thicker labelled line of a topographic map. detail is low, medium or high: how much small bumps and wiggles are kept. smooth sets the blur in metres directly; 0 turns generalisation off.

kh.define

kh.define(name, style)

Save a style under a name so it can be used as preset-<name>.

kh.explain

kh.explain(style)

Show what a style compiles to and which token set each part.

kh.help

kh.help(name=None)

Print every utility, or the details and examples for one.

kh.imagery

kh.imagery(source=2016, attribution=None, max_zoom=14)

Choose the imagery for basemap-satellite and basemap-hybrid.

source is a Sentinel-2 cloudless year (2016 is free for any use with credit; 2017 to 2024 are non-commercial only) or your own tile URL with {z}, {x} and {y}, such as a provider you hold a key for. Returns the imagery now in use.

kh.layer

kh.layer(gdf, style, colors=None, order=None)

Native Lonboard layers for a style: one per geometry type present.

kh.legend

kh.legend(gdf, style, dark=False, colors=None, order=None, **options)

The legend HTML for a style on its own, for use with your own Lonboard map.

kh.map

kh.map(gdf, style, legend=None, basemap=None, height=500, title=None, subtitle=None, source=None, colors=None, order=None, kicker=None, title_style=None, legend_style=None, shape=None, backdrop=None)

One GeoDataFrame, one style, one map; title, subtitle and source draw the title card.

kh.palette

kh.palette(name, colors, kind='sequential')

Register your own ramp, then use it as ramp-<name>.

kh.parse

kh.parse(style)

Compile a style string to a StyleSpec, raising StyleSyntaxError on any problem.

kh.ramps

kh.ramps(kind=None, search=None, source=None, checks=True)

Every ramp as a swatch strip; filter by kind, a word in the name, or source.

kh.theme

kh.theme(name, base='paper', ramp=None, labels=None, **elements)

Register your own theme from a base theme and element colours, then use theme-<name>.

kh.utilities

kh.utilities()

Every utility kharita understands.

kh.validate

kh.validate(style, columns=None)

Parse a style and, if columns are given, check every referenced column exists.