Crates.io | mapvas |
lib.rs | mapvas |
version | 0.2.6 |
created_at | 2023-08-10 20:13:29.816459+00 |
updated_at | 2025-08-14 07:22:42.092125+00 |
description | A map viewer with drawing functionality |
homepage | https://github.com/UdHo/mapvas |
repository | https://github.com/UdHo/mapvas.git |
max_upload_size | |
id | 941312 |
size | 10,658,803 |
A map canvas showing OSM tiles with advanced visualization capabilities including temporal data support, interactive controls, and drawing functionality.
The repo contains two binaries:
Make sure you have Rust installed (stable toolchain recommended).
Manually:
cd mapvas ; cargo install --path . --locked
Via cargo from crates.io:
cargo install mapvas --locked
Via brew on MacOs:
brew tap udho/mapvas && brew install mapvas
Start mapvas
and a map window will appear.
Navigation & View:
Key/Action | Description |
---|---|
Mouse Wheel / +/- | Zoom in and out |
Left Click + Drag | Pan the map |
Arrow Keys | Pan the map with keyboard |
F | Focus/center all drawn elements |
S | Take screenshot of current view |
Sidebar & UI:
Key/Action | Description |
---|---|
F1 / Ctrl+B | Toggle sidebar |
☰ Button | Show sidebar |
✕ Button | Close sidebar |
Search & Navigation:
Key/Action | Description |
---|---|
/ | Open search mode (vim-style) |
& | Open filtering mode |
: | Enter command mode |
Double-Click | Navigate nested collections or trigger popups |
Right-Click | Show context menu with element information |
L | Show label at mouse position (Mac-friendly) |
Timeline Controls (when temporal data loaded):
Key/Action | Description |
---|---|
Ctrl+L | Toggle interval lock mode |
Timeline Handles | Drag to adjust time interval |
Play/Pause | Control temporal animation |
Step Buttons | Step forward/backward through time |
Speed Slider | Adjust playback speed (0.25x-4x) |
Data Management:
Key/Action | Description |
---|---|
V | Paste clipboard content (auto-parsed) |
File Drop | Drag and drop files onto map |
Delete/Fn+Delete | Clear all elements |
C | Copy label text (when label popup shown) |
Mapcat reads input from stdin or files and uses intelligent auto-parsing to detect the format, or you can specify a parser explicitly. It uses various parsers to handle different data formats. It shows the parsed result on a single instance of mapvas, which it spawns if none is running.
The auto parser (default since v0.2.6) intelligently detects input format:
.geojson
, .json
, .gpx
, .kml
, .xml
extensions with fallback chains# Auto-detect format from file extension
mapcat data.geojson
mapcat routes.gpx
mapcat points.kml
# Auto-detect format from piped content
curl 'https://api.example.com/geojson' | mapcat
cat coordinates.txt | mapcat
You can override auto-detection and specify a parser explicitly:
# Force specific parser
mapcat -p grep data.txt
mapcat -p geojson data.json
mapcat -p ttjson routes.json
Available parsers: auto
(default), grep
, ttjson
, json
, geojson
, gpx
, kml
This parser greps for coordinates latitude and longitude as float in a line. In addition it supports colors and filling of polygons.
The input can come from a pipe or from files.
mapcat <files_with_coordinates>
Examples:
echo "52.521853, 13.413015" | mapcat
echo "50.942878, 6.957936 52.521853, 13.413015 green\n 50.942878, 6.957936 52.373520, 4.899766 red" | mapcat
echo "50.942878, 6.957936 random garbage words 52.521853, 13.413015 yellow spaces after the coordinate-comma is not important: 52.373520,4.899766" | mapcat
echo "50.942878, 6.957936 52.521853, 13.413015 52.373520,4.899766 blue transparent" | mapcat
Filling a polyline causes it to be drawn as closed polygon.
echo BFoz5xJ67i1B1B7PzIhaxL7Y | mapcat
echo '_p~iF~ps|U_ulLnnqC_mqNvxq@' | mapcat
echo "13.413015, 52.521853" | mapcat -i
echo "clear" | mapcat
The -r parameter clears the map before drawing new elements.
echo "52.5,12.5" | mapcat -r
"(.*)"
which captures everything.echo "52.4,12.4" | mapcat -l "(.*)"
--focus (-f) zooms and pans to show all elements on the map.
--screenshot <file.png>
takes a screenshot of the map. If mapvas is not already running it should probably be combined with -f
.
If the path to the file is relative (or the S
key is used) the screenshot will be saved in the working directory unless MAPVAS_SCREENSHOT_PATH
is set.
Draws a random polyline of a given length. The following command draws a random walk consisting of 20000 polylines of a random length between 1 and 10.
echo "20000" | mapcat -p random
Draws routes or ranges from the TomTom routing api.
curl 'https://api.tomtom.com/routing/1...' | mapcat -p ttjson -c green
MapVas supports displaying directional information for point geometries:
Heading support:
heading
, bearing
, direction
, course
(in order of precedence)// GeoJSON example with heading
{
"type": "Feature",
"geometry": { "type": "Point", "coordinates": [13.4, 52.5] },
"properties": { "heading": 45.0, "label": "Northeast direction" }
}
MapVas uses a configuration file located at ~/.config/mapvas/config.json
. The configuration file is automatically created on first run with default settings.
You can also set MAPVAS_CONFIG
environment variable to use a custom config directory.
Example configuration:
{
"tile_provider": [
{
"name": "OpenStreetMap",
"url": "https://tile.openstreetmap.org/{zoom}/{x}/{y}.png"
},
{
"name": "TomTom",
"url": "https://api.tomtom.com/map/1/tile/basic/main/{zoom}/{x}/{y}.png?tileSize=512&key=***"
}
],
"tile_cache_dir": "/Users/username/.mapvas_tile_cache",
"commands_dir": "/Users/username/.config/mapvas/commands",
"search_providers": [
{"Coordinate": null},
{"Nominatim": {"base_url": null}}
],
"heading_style": "Arrow"
}
Tile caching is enabled by default and tiles are stored in ~/.mapvas_tile_cache
. You can change this location in the config file or disable it by setting tile_cache_dir
to null
.
# Run with profiling enabled
cargo run --bin mapvas --features profiling
# View profiling data
cargo install puffin_viewer
puffin_viewer --url=http://127.0.0.1:8585
Variable | Description | Default |
---|---|---|
MAPVAS_CONFIG |
Custom config directory | ~/.config/mapvas |
MAPVAS_TILE_URL |
Custom tile provider URL (legacy) | Uses config file |
MAPVAS_SCREENSHOT_PATH |
Default screenshot save location | Current directory |