Closed juaxs closed 4 years ago
Hi there!
This definitely is possible with Unfolding. But this is not something Unfolding provides out of the box. Roughly, you need to update the position in some event listener (which gets called when new coordinates arrive, or on some specified interval). When you want to show some trajectory (i.e. a trail behind the most recent coordinates) you need to store them somewhere.
Hi there!
This definitely is possible with Unfolding. But this is not something Unfolding provides out of the box. Roughly, you need to update the position in some event listener (which gets called when new coordinates arrive, or on some specified interval). When you want to show some trajectory (i.e. a trail behind the most recent coordinates) you need to store them somewhere.
Do you have any example showing that? I tried to only show one location with variable lat/lon like this:
UnfoldingMap map;
float lat;
float lon;
Location locationLocal = new Location(lat, lon);
setup(){
String portName = "COM4";
myPort = new Serial(this, portName, 57600);
myPort.bufferUntil('\n');
map = new UnfoldingMap(this, 19, 359, 635, 266, new Microsoft.AerialProvider());
map.setTweening(false);
map.zoomToLevel(16);
map.panTo(locationLocal);
MapUtils.createDefaultEventDispatcher(this, map);
}
void draw() {
sensor = split(dato, '\t');
lat = float(sensor[18]);
lon = float(sensor[19]);
drawMap();
}
void drawMap() {
map.draw();
fill(255, 0, 0);
ScreenPosition posLocal = map.getScreenPosition(locationLocal);
float s = map.getZoom();
ellipse(posLocal.x, posLocal.y, s/2000, s/2000);
}
void serialEvent(Serial myPort) {
dataReading = myPort.readStringUntil('\n');
dato=dataReading;
}
All values are always updating on the sensor array, but i dont get the map moving according to the movment of the gps location.
In principle, your code seems to be on a good way. It seems to miss converting dato
(which I don't see defined at all) to locationLocal
. Depending no your String coming in from the serial connection you might need to convert the lat/lng first.
This would update the shown circle to the last read position. If you want to center the map to that position you'd need to pan to that location (map.panTo(...)
).
Hello.
Currently im working on a Teensy/based Flight computer using Arduino IDE and Processing for GUI but im trying to create a real time map showing the aircraft position using the lon/lat coordenates from the GPS module but it is'nt working or maybe is not possible yet. I only can get a static position with static coordenates.
So thats my question, it is possible to create a dynamic map using this repository with moving objects?
Thank you so much.