carbonian-map - an offline map in the terminal
carbonian-map [tui] [--mode
braille|pixel] [--pixel-scale N]
[--palette NAME|FILE] [--passthrough]
carbonian-map COMMAND [ARGUMENT ...]
carbonian-map --once [--size SIZE] [--center
LAT,LON] [--zoom Z] [--pin LAT,LON,LABEL]
[--route LAT,LON:LAT,LON:...] [--circle
LAT,LON,KM,LABEL] [--geojson PATH] [--ansi]
[--png FILE]
Draws a map in the terminal, from data on the disk; it never
touches the network. It is one Python 3 file with no dependencies (it runs
on the Pi 2). There are two output modes, with the same data, view and
commands:
- braille
- (the default) Braille characters (2x4 dots per cell) in any terminal,
using only the terminal's own 16 ANSI colours, so the map follows whatever
carbonian-palette(1) sets.
- pixel
- A raster image in the palette's real colours, sent as sixel (foot, tmux
3.4 or newer built with sixel). Without sixel the map falls back to
braille.
The view is Web Mercator with continuous zoom: at zoom 0 the world
is 256 dots wide and every step doubles it (about 3 is a continent, 7 a
region, 11 a city, 15 a neighbourhood; the maximum is 19).
Other programs can draw on the running map through a control
socket, with the same words as the commands below. The map is not packaged
yet.
- --mode
MODE
- braille or pixel.
- --pixel-scale N
- Screen pixels per logical pixel in the pixel mode, 1 to 4 (default
2).
- --palette
NAME|FILE
- The palette of the pixel mode (also the variable
CARBONIAN_PALETTE_FILE).
- --passthrough
- Send the sixel through tmux's passthrough (needs set -g
allow-passthrough on in tmux).
- --once
- Draw one frame on standard output and exit, with no terminal needed.
--size is COLSxROWS (default the terminal's, else 120x40),
--pin, --route , --circle and --geojson may be
repeated, --ansi adds colours (plain text by default). With
--mode pixel it writes the sixel image; with --png
FILE it writes a PNG of the same raster instead, and --size is
then WIDTHxHEIGHT in pixels.
- arrows, h j k l
- Pan.
- + = / - _
- Zoom in and out (half a step).
- 0
- Back to the start view.
- f
- Fit all overlays.
- c
- Clear all overlays.
- m
- Toggle braille and pixel.
- s
- Pixel scale 1, 2, 3, 4.
- r
- Repaint: read the palette again and measure the terminal's cells.
- ?
- Help and the attribution; any key closes it.
- q
- Quit.
- mouse wheel, left
drag
- Zoom around the pointer; pan.
Sent to the running map through its control socket. The reply
starts with ok or error: REASON; the program prints it and
exits 0 on ok, 1 on an error or when no map is running. A relative
geojson path is made absolute first.
- pin ID LAT LON
[color=N] [LABEL...]
- A pin with an optional label.
- route ID
[color=N] LAT,LON LAT,LON ...
- A polyline (2 to 20000 points).
- circle ID LAT
LON RADIUS_KM [color=N] [LABEL...]
- A circle (0.001 to 20000 km).
- geojson ID
[color=N] PATH
- A GeoJSON file (Point, LineString, Polygon, Multi*, GeometryCollection,
Feature, FeatureCollection) of at most 5 MB; the name of a Point is its
label. Polygons are outlines.
- label ID LAT LON
[color=N] TEXT...
- Text without a pin.
- rm ID
- Remove an overlay.
- clear
- Remove all overlays.
- goto LAT LON
[ZOOM]
- Move the view.
- zoom Z
- Set the zoom (0 to 19).
- fit
- Fit all overlays in the window.
- list
- ok N and one line per overlay.
- get
- ok LAT LON ZOOM COLS ROWS.
- snapshot
- ok, then the current frame as plain text lines.
- mode [braille|pixel]
- Report or switch the mode.
- scale
N
- The pixel scale.
- reload
- Read the palette again.
ID is 1 to 32 letters, digits, dots, underscores or
hyphens; adding an existing ID replaces it. color=N is 0 to 15
or a name such as red or bright-cyan. At most 500 overlays.
Latitudes are -90 to 90, longitudes -180 to 180. Control characters are
stripped from labels.
- $XDG_RUNTIME_DIR/carbonian-map.sock
- The control socket (mode 600).
- /etc/carbonian/map.conf
- ~/.config/carbonian/map.conf
- The settings (see map.conf(5)).
- ~/.local/share/carbonian/map/, /usr/share/carbonian/map/
- Where layer files are looked up, after the data folders of
map.conf.
carbonian-map
carbonian-map pin home -23.5505 -46.6333 Home
carbonian-map route to-work color=bright-green -23.5505,-46.6333 -23.5614,-46.6559
carbonian-map --once --size 120x40 --pin -23.55,-46.63,Home
carbonian-foot -f carbonian-map --mode pixel
Map data: Natural Earth (public domain), and OpenStreetMap,
© OpenStreetMap contributors (ODbL).
map.conf(5), carbonian-foot(1),
carbonian-palette(1)