The Meshtastic Map Backend is designed to recieve meshtastic packets from the mesh or an MQTT server, process it, and offer a geoJSON API that can be consumed by mapping front-ends.
There are two main modes, Local Mesh and MQTT.
If you have a Meshtastic Device connected to your PC, you can use the Meshtastic
Serial Interface to receive packets. Start the backend using the --port
or --ble
arguments to connect to the device.
./backend.py --port /dev/ttyACM0
To gather data from an MQTT server instead, specify the standard set of variables for an MQTT connection:
./backend.py --mqtt-host mqtt.meshtastic.org --mqtt-user meshdev --mqtt-pass large4cats --mqtt-topic msh/TW/#
By default, an HTTP server will run at port 8100, and offer the following endpoints:
Each node listed in /nodes may have the following properties
:
Specify a point with --latitude
and --longitude
, and set --max-distance
to limit the nodes recorded
to within that number of kilometers of the point. Set --max-distance 0
to disable the limit.
If you only want to map your own nodes, list each node id (one-per-line) in a file and pass that file
to the --exclusive
parameter.
/map
provides a basic leaflet.js map that show nodes and links, primarily for debugging.
You can set the center of that map by specifying --latitude
and --longitude
, in addition to the
zoom level (--zoom
).
If you want to use an alternative source for the GeoJSON API endpoint, you can specify a URL using --geoJSON
.
If the app detects it is running as a Railway app, the Railway Public Endpoint will be used instead.
By default, when using MQTT, the backend only processes MAP_REPORT_APP
packets. If you are using a
private MQTT server for your local community, you can disable this limitation by specifying
--map-reports-only False
.
Setting the --lastmessage
to True will store and display the last message received by each node.
This is disabled by default.
Meshtastic Map Backend can be run with flask, using:
flask --app backend:main run