Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/constants/map

lib/constants/map

Map-related constants shared across map components.

Interfaces

ClusterStats

Cluster statistics interface for percentile breakpoints.

Properties

p20

p20: number

p40

p40: number

p60

p60: number

p80

p80: number

p100

p100: number

Variables

MAP_STYLES

const MAP_STYLES: object

Map style URLs for light and dark themes. These point to the locally-served VersaTiles cartographic styles.

Type declaration

light

readonly light: "/map-styles/cartographic-light.json" = "/map-styles/cartographic-light.json"

dark

readonly dark: "/map-styles/cartographic-dark.json" = "/map-styles/cartographic-dark.json"


DEFAULT_CLUSTER_STATS

const DEFAULT_CLUSTER_STATS: object

Default cluster statistics used when no data is available. These provide sensible defaults for percentile-based cluster visualization.

Type declaration

p20

readonly p20: 2 = 2

p40

readonly p40: 5 = 5

p60

readonly p60: 10 = 10

p80

readonly p80: 20 = 20

p100

readonly p100: 50 = 50

Functions

ensureAscendingPercentiles()

ensureAscendingPercentiles(rawStats): ClusterStats

Ensure percentile values are strictly ascending for MapLibre step expressions.

MapLibre step expressions require strictly ascending breakpoints. This function takes raw percentile values and ensures each subsequent percentile is at least 1 greater than the previous one.

Parameters

rawStats

Partial<ClusterStats>

Raw percentile statistics (may have equal or non-ascending values)

Returns

ClusterStats

Percentile statistics with strictly ascending values

Example

// Raw stats from database might have equal values const raw = { p20: 5, p40: 5, p60: 5, p80: 10, p100: 20 }; const ascending = ensureAscendingPercentiles(raw); // Result: { p20: 5, p40: 6, p60: 7, p80: 10, p100: 20 }
Last updated on