transitlos.map.col_info¶
Small "i" buttons next to every column name shown on a MapLibre page (census panel, selectors, regression, distribution, popups).
COL_INFO_JS reads window.__columnMeta ({column: {name, source, level, description, unit, original}}, emitted by col_info_script
from the same rows as the Metadata tab, see transitlos.map.build._column_metadata_rows). A MutationObserver scans the panels that show
column names (stats panel, popups, selectors, legend) and appends a tiny "i" to every element whose text is exactly a known column label; a
click opens a small floating panel with the column's source, native level and description. A label with no metadata simply gets no button.
column_meta_json(metadata_rows, extra=None)
¶
Column metadata (name, source, levels, year, description...) as JSON for the info buttons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metadata_rows
|
Iterable[Dict]
|
One dict per column ( |
required |
extra
|
Dict[str, Dict]
|
Extra |
None
|
Returns:
| Type | Description |
|---|---|
str
|
JSON text. |
col_info_script(metadata_rows, extra=None, labels=None, lookup_labels=None)
¶
<script> block: the metadata lookup plus the info-button machinery (runs once per page).
labels is {column: display name} computed in Python so the JS panels show exactly the same readable names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metadata_rows
|
Iterable[Dict]
|
One dict per column. |
required |
extra
|
Dict[str, Dict]
|
Extra |
None
|
labels
|
Dict[str, str]
|
|
None
|
lookup_labels
|
Dict[str, str]
|
|
None
|