FlightAirMap icon indicating copy to clipboard operation
FlightAirMap copied to clipboard

Plot archived flights/tracks seen in 2D mode

Open wohali opened this issue 6 years ago • 22 comments

Hi there, great software! Thanks for all the good work.

I searched the GH issues but I couldn't find anyone who asked for this already.

Would it be possible to select a date/time range (to/from) and plot everything seen for that time on the map?

wohali avatar Oct 09 '17 06:10 wohali

It's already available in Beta for 3D mode if archive mode is enabled. Not yet available for 2D mode, but it's in dev.

Already existing issue: https://github.com/Ysurac/FlightAirMap/issues/229

Ysurac avatar Oct 09 '17 07:10 Ysurac

That's great! My browser struggles with 3D performance, so I don't use that mode much.

How do I activate it for 3D mode? I'm using git master.

wohali avatar Oct 09 '17 17:10 wohali

In install/index.php, enable Archive all flights data and Keep flights data for xx months in archive* to more than 0.

Ysurac avatar Oct 09 '17 18:10 Ysurac

OK, I've done that and let it run for a bit. Now, when I go to 3D mode, how do I switch to "historic view" instead of "now view"?

EDIT: I see it, the Archive button. The UI is a little confusing, but I'm sure I'll work it out.

Editing the title of this ticket to reflect that it's not yet available in 2D mode.

wohali avatar Oct 12 '17 00:10 wohali

There is now a 2D archive mode, even if not yet perfect...

Ysurac avatar Oct 19 '17 08:10 Ysurac

cool idea :) does not work at the moment (at least osx safari/firefox). saw no planes - and no way to return to live mode without manually deleting the fam cookies ...

but what is more interesting to me - i have a mysql database that holds exactly the same data that the aircraft.json files have. what would be the easiest way to playback those data via fam?

TomMuc1 avatar Oct 20 '17 11:10 TomMuc1

If you don't enable No archive (or noarchive for $globalSources in settings.php), this is working. You can return to live mode in sidebar Back from archive view or the eject button in archive box.

Not possible to playback outside data via fam for now.

Ysurac avatar Oct 20 '17 11:10 Ysurac

$globalSources = array(array('host' => 'http://127.0.0.1/dump1090/data/aircraft.json','port' => '80','name' => 'JSON','format' => 'aircraftjson','sourcestats' => TRUE,'noarchive' => FALSE,'timezone' => 'UTC','callback' => FALSE));

sorry none of the above ways worked whether in firefox nor safari - just deleting the cookie brought me back to live mode

of course it is not possible now while the builtin mode is still beta :) but after this period what would you think could be the best way?

edit: but no hurry if the above behavior really is a bug - no big deal! it's nice to know that this feature is under development ...

TomMuc1 avatar Oct 20 '17 11:10 TomMuc1

Should work with Firefox now.

Adding archive data to DB is not in roadmap for now. Maybe later but data will need to be in a supported format.

Ysurac avatar Oct 20 '17 12:10 Ysurac

yep - now going back from archive to live mode works onclick both times:) still i do not see any aircraft when in archive mode ... anways no big deal

yes - that was the question - what is a 'supported format'? maybe in addition you could give me a hint where i find the actual database to fam wrapper scripts you use in the actual 2d beta version ...

TomMuc1 avatar Oct 20 '17 13:10 TomMuc1

I see aircrafts in archive... Did you choose a range where you really have flights ? It's in UTC. If you choose a too big range, you can reach a PHP memory limit problem or a timeout. it use data from table spotter_archive.

Ysurac avatar Oct 20 '17 13:10 Ysurac

i see the counter clock running in orange layer window - but zero aircraft shown on map ...

bildschirmfoto 2017-10-20 um 15 37 21

TomMuc1 avatar Oct 20 '17 13:10 TomMuc1

but maybe i missed another needed setting in settings.php $globalArchive = TRUE; $globalArchiveMonths = '1'; $globalArchiveKeepTrackMonths = '1'; $globalArchiveKeepMonths = '1'; $globalArchiveResults = TRUE;

TomMuc1 avatar Oct 20 '17 13:10 TomMuc1

it use data from table spotter_archive.

and what script(s) fetch the data there and forward to fma map gui?

TomMuc1 avatar Oct 20 '17 13:10 TomMuc1

Do you have data in spotter-archive table ? Do you have any error in JS dev console ?

The script archive-geojson.php get all archive data for 2D map.

Ysurac avatar Oct 20 '17 13:10 Ysurac

spotter-archive table - i see about 350.000 rows nope - no errors in firefox developer tool js console just saying: Archive mode map.2d.js.php:1:1 Load Archive geoJson map-aircraft.2d.js.php:551:2 Play map-aircraft.2d.js.php:760:5

thanks :) i'll look into archive-geojson.php

TomMuc1 avatar Oct 20 '17 14:10 TomMuc1

What is the output of http://127.0.0.1/archive-geojson.php?archive&begindate=1508499999&enddate=1508500357&speed=1 ?

Ysurac avatar Oct 20 '17 14:10 Ysurac

Fixed in latest commit. Error on MySQL query (working for postgreSQL)

Ysurac avatar Oct 20 '17 14:10 Ysurac

nope - sorry firefox and safari on osx - now puts quite heavy cpu-load on frontend machine but still no aircrafts - firefox console says: Archive mode map.2d.js.php:1:1 window.controllers/Controllers sollte nicht mehr verwendet werden. Verwenden Sie es nicht für die Browser-Erkennung. flightairmap Load Archive geoJson map-aircraft.2d.js.php:551:2

but cmon - i don't care - this is really a nice to have sometimes - but nothing i need over the next days :)

cheers + have a nice weekend tom

TomMuc1 avatar Oct 20 '17 16:10 TomMuc1

This time I add a "nice" dialog box with the error. I think I will use more of that...

Ysurac avatar Oct 20 '17 17:10 Ysurac

excellent idea! i'm still in love with the single aircraft 3d mode that runs even on my 8! year old macbook in safari browser like a charm :) thanx again for adding this feature! https://discussions.flightaware.com/t/flightairmap-watching-your-live-data-next-level/26536/43?u=tommuc

TomMuc1 avatar Oct 20 '17 21:10 TomMuc1

tonight wrote a quick and dirty database to fam replay wrapper - maybe one has use for ...

<?php

// set hex and date you want to replay and set $i to timelapse-factor e.g. 10 is 10-times faster than reality
$user_hex = 'YOUR_HEX';    $date_to_watch = 'YYYY-MM-DD%';    $speed_factor = 10;

$sql = "select * from aircrafts where hex='$user_hex' and message_date like '$date_to_watch' and squawk!='' and flight!='' and lat!='' and lon!='' and nucp!='' and seen_pos!='' and altitude!='' and vert_rate!='' and track!='' and speed!='' and category!='' and messages!='' and seen!='' and rssi!='' order by id asc";
$db = new PDO('mysql:host=127.0.0.1;dbname=adsb', 'root', 'YOUR_PASSWORD');
$stmt = $db->prepare($sql);
$stmt->execute();
$select = $stmt->fetchAll();

$i = 0;

foreach  ($select as $result) {

	$aircraft_json = '{ "now" : ' . $result['now'] . ',' . PHP_EOL;
	$aircraft_json .= '  "messages" : 60296972,' . PHP_EOL;
	$aircraft_json .= '  "aircraft" : [' . PHP_EOL;
	$aircraft_json .= '    {"hex":"' . $result['hex'] . '","squawk":"' . $result['squawk'] . '","flight":"' . $result['flight'] . '","lat":' . $result['lat'] . ',"lon":' . $result['lon'] . ',"nucp":' . $result['nucp'] . ',"seen_pos":' . $result['seen_pos'] . ',"altitude":' . $result['altitude'] . ',"vert_rate":' . $result['vert_rate'] . ',"track":' . $result['track'] . ',"speed":' . $result['speed'] . ',"category":"' . $result['category'] . '","mlat":"","tisb":"","messages":' . $result['messages'] . ',"seen":' . $result['seen'] . ',"rssi":' . $result['rssi'] . '}' . PHP_EOL;
	$aircraft_json .= '  ]' . PHP_EOL;
	$aircraft_json .= '}' . PHP_EOL;
	$i++;

	if ($i == $speed_factor) { file_put_contents('/YOUR_PATH/data/aircraft.json', $aircraft_json, LOCK_EX); $i = 0; sleep(1); }

}

?>

TomMuc1 avatar Oct 26 '17 19:10 TomMuc1