Ysurac / FlightAirMap

Open source project displaying live aircrafts, ships or trackers on 2D/3D map. Browse through the data based on a particular aircraft, airline, airport, tracker or vessel to search through the database or see extensive statistics. Can use ADS-B in SBS1 format (dump1090, Radarcape,...), VRS, VA (VATSIM, IVAO whazzup.txt, phpvms,...), ACARS (acarsdec, acarsdeco2), APRS, AIS as datasource.
https://www.flightairmap.com/
GNU Affero General Public License v3.0
516 stars 157 forks source link

Plot archived flights/tracks seen in 2D mode #361

Open wohali opened 6 years ago

wohali commented 6 years ago

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?

Ysurac commented 6 years ago

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

wohali commented 6 years ago

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.

Ysurac commented 6 years ago

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

wohali commented 6 years ago

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.

Ysurac commented 6 years ago

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

TomMuc1 commented 6 years ago

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?

Ysurac commented 6 years ago

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.

TomMuc1 commented 6 years ago
$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 ...

Ysurac commented 6 years ago

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.

TomMuc1 commented 6 years ago

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 ...

Ysurac commented 6 years ago

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.

TomMuc1 commented 6 years ago

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 commented 6 years ago

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

TomMuc1 commented 6 years ago

it use data from table spotter_archive.

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

Ysurac commented 6 years ago

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.

TomMuc1 commented 6 years ago

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

Ysurac commented 6 years ago

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

Ysurac commented 6 years ago

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

TomMuc1 commented 6 years ago

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

Ysurac commented 6 years ago

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

TomMuc1 commented 6 years ago

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 commented 6 years ago

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); }

}

?>