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
constMAP_STYLES:object
Map style URLs for light and dark themes. These point to the locally-served VersaTiles cartographic styles.
Type declaration
light
readonlylight:"/map-styles/cartographic-light.json"="/map-styles/cartographic-light.json"
dark
readonlydark:"/map-styles/cartographic-dark.json"="/map-styles/cartographic-dark.json"
DEFAULT_CLUSTER_STATS
constDEFAULT_CLUSTER_STATS:object
Default cluster statistics used when no data is available. These provide sensible defaults for percentile-based cluster visualization.
Type declaration
p20
readonlyp20:2=2
p40
readonlyp40:5=5
p60
readonlyp60:10=10
p80
readonlyp80:20=20
p100
readonlyp100: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
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 }