Docs
Map
The Map widget shows pins on a map. Your board sends a latitude and a longitude for each one.
Use it for: a GPS tracker, a delivery bike, sensors spread over a field, the last known position of something that moves.
| Setting | What it does |
|---|---|
| Pin | the virtual pin your code writes to |
| Pin to latest point | keep the view centred on the newest position |
| Show my location | draw the phone position too |
| Satellite | switch the base map |
Open these from the canvas: tap Edit, then long press the widget and choose Configure.
Example
A GPS module reporting a position every ten seconds.
#include <PlynxSimpleEsp32.h>
WidgetMap myMap(V22);
PlynxTimer timer;
void sendPosition()
{
float lat = 45.4642; // replace with your GPS reading
float lon = 9.1900;
myMap.location(1, lat, lon, "Bike");
}
void setup()
{
Serial.begin(115200);
// Auto setup: WiFi and the Plynx token are configured from the app.
//
// To provide them directly in the sketch instead, use:
// Plynx.begin(auth, ssid, pass);
Plynx.begin();
timer.setInterval(10000L, sendPosition);
}
void loop()
{
Plynx.run();
timer.run();
} myMap.location(index, lat, lon, label) places one point. The index identifies
it: sending the same index again moves that point, a new index adds another.
myMap.clear() removes every point.
Ten seconds suits a vehicle. A tracker on a battery can go much slower, and each message costs power.
Troubleshooting
| Problem | Check |
|---|---|
| Map is empty | the widget pin and the WidgetMap pin do not match |
| Points pile up instead of moving | a new index each time; reuse the same one |
| Position lands in the sea | latitude and longitude are swapped |
| Track is jagged | GPS noise; average a few readings before sending |