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
522 stars 158 forks source link

daemon-spotter Error #224

Closed gugaua closed 8 years ago

gugaua commented 8 years ago

I have a fresh install of FlightAirMap and I manually start daemon-spotter.php but get a lot of errors. Error : SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION FlightAirMap.ST_Within does not exist


www-data@kd56398:~/html/map/scripts$ php5 daemon-spotter.php Connecting... Connect to phpvmacars source (http://www.fscva.net/va2/action.php/acars/data)... Connected! SCAN MODE

*** New aircraft hex : 303031 *** Error : SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION FlightAirMap.ST_Within does not exist Update last seen flights data...


www-data@kd56398:~/html/map/scripts$ php5 daemon-spotter.php Connecting... Connect to phpvmacars source (http://www.fscva.net/va2/action.php/acars/data)... Connected! SCAN MODE

*** New aircraft hex : 303031 *** Error : SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION FlightAirMap.ST_Within does not exist Update last seen flights data... ----- No Airport near last coord. Latitude : 49.651455314948 - Longitude : 9.3551417554292 - MinDist : 50 www-data@kd56398:~/html/map/scripts$ php5 daemon-spotter.php Connecting... Connect to phpvmacars source (http://www.fscva.net/va2/action.php/acars/data)... Connected! SCAN MODE

*** New aircraft hex : 303031 *** Check if aircraft is already in DB... Already in DB. DATA : hex : 303031 - ident : TLH0001 - ICAO : A380 - Departure Airport : EDDF - Arrival Airport : EDDM - Latitude : 48.525544708171 - Longitude : 10.513471989621 - waypoints : - Altitude : 180 - Heading : 139 - Speed : 315 - Departure Airport Time : 17:26:00 - Arrival Airport time : 18:10:07 - Pilot : MrFussL - Source name : FSCVA \o/ Add TLH0001 from phpvmacars in Live DB : (Add to SBS archive : Error : SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION FlightAirMap.ST_Within does not exist success)success ---- Deleting Live Spotter data Not updated since 2 hour... Done Check if aircraft is already in DB... Already in DB. DATA : hex : 303031 - ident : TLH0001 - ICAO : A380 - Departure Airport : EDDF - Arrival Airport : EDDM - Latitude : 48.525544708171 - Longitude : 10.513471989621 - waypoints : - Altitude : 180 - Heading : 139 - Speed : 315 - Departure Airport Time : 17:26:00 - Arrival Airport time : 18:10:07 - Pilot : MrFussL - Source name : FSCVA \o/ Add TLH0001 from phpvmacars in Live DB : (Add to SBS archive : Error : SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION FlightAirMap.ST_Within does not exist success)success Check if aircraft is already in DB... Already in DB. DATA : hex : 303031 - ident : TLH0001 - ICAO : A380 - Departure Airport : EDDF - Arrival Airport : EDDM - Latitude : 48.468565838894 - Longitude : 10.611619202552 - waypoints : - Altitude : 180 - Heading : 94 - Speed : 321 - Departure Airport Time : 17:26:00 - Arrival Airport time : 18:10:07 - Pilot : MrFussL - Source name : FSCVA \o/ Add TLH0001 from phpvmacars in Live DB : (Add to SBS archive : Error : SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION FlightAirMap.ST_Within does not exist success)success

Is there a trick to repair it?

Ysurac commented 8 years ago

What is the DB used ? MySQL, MariaDB or PostgreSQL ? and what is the version number ? _STWithin is a function that is supported since MySQL 5.6.1n MariaDB 5.3.3 and in PostGIS with PostgreSQL.

I will try to disable it if not supported.

Ysurac commented 8 years ago

This is now disable if table countries was not added during install now, in latest commit.

gugaua commented 8 years ago

I use debian 8 with default 5.5.52-0+deb8u1.

How do I need to install that countries will not be populated

I installed the following way.

git clone https://github.com/Ysurac/FlightAirMap Then via WEBUI setup after that I changed required/settings globalinstalled to "FALSE" and run "php5 populate_all.php" after that I changed required/settings globalinstalled to "TRUE" and started "php5 daemon-spotter.php"

Another thing is that mysql is using a lot of resources 60% CPU after start daemon-spotter here is one second in apache2

134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 5.0) AppleWebKit/5331 (KHTML, like Gecko) Chrome/13.0.885.0 Safari/5331" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Macintosh; U; U; PPC Mac OS X 10_5_8; en-US) AppleWebKit/5312 (KHTML, like Gecko) Version/4.0.3 Safari/5312" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_7_2) AppleWebKit/5340 (KHTML, like Gecko) Chrome/13.0.872.0 Safari/5340" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/6.0; .NET CLR 3.5.30729.35)" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 6.1; en-US; rv:18.0) Gecko/20100101 Firefox/18.0" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_9; rv:26.0) Gecko/20100101 Firefox/26.0" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 6.0; en-US; rv:19.0) Gecko/20100101 Firefox/19.0" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; Trident/4.0; .NET CLR 3.0.4506.250)" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.0; WOW64; Trident/5.0; .NET CLR 2.0.50727.379)" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; .NET CLR 2.0.50727.483)" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; .NET CLR 2.0.50727.94)" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/5320 (KHTML, like Gecko) Chrome/15.0.868.0 Safari/5320" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.1; WOW64; Trident/4.0; .NET CLR 3.5.30729.74)" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/7.0; .NET CLR 2.0.50727.474)" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 6.1; en-US; rv:19.0) Gecko/20100101 Firefox/19.0" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/5311 (KHTML, like Gecko) Chrome/14.0.835.0 Safari/5311" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/5331 (KHTML, like Gecko) Chrome/13.0.843.0 Safari/5331" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 5.1; en-US; rv:17.0) Gecko/20100101 Firefox/17.0" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 6.1; en-US; rv:17.0) Gecko/20100101 Firefox/17.0" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/5.0; .NET CLR 3.5.30729.580)" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Macintosh; U; U; PPC Mac OS X 10_6_4; en-US) AppleWebKit/5341 (KHTML, like Gecko) Version/4.0.3 Safari/5341" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 5.1; en-US; rv:23.0) Gecko/20100101 Firefox/23.0" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Macintosh; U; U; Intel Mac OS X 10_70) AppleWebKit/5362 (KHTML, like Gecko) Chrome/13.0.806.0 Safari/5362" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/5342 (KHTML, like Gecko) Chrome/15.0.852.0 Safari/5342 OPR/16.0.128177" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; WOW64; Trident/6.0; .NET CLR 3.5.30729.358)" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 5.0) AppleWebKit/5340 (KHTML, like Gecko) Chrome/14.0.839.0 Safari/5340" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.0; WOW64; Trident/5.0; .NET CLR 2.0.50727.297)" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 5.1; en-US; rv:18.0) Gecko/20100101 Firefox/18.0" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.1; WOW64; Trident/5.0; .NET CLR 3.0.4506.203)" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/5352 (KHTML, like Gecko) Chrome/15.0.898.0 Safari/5352" 134.255.225.217 - - [20/Oct/2016:09:49:28 +0200] "GET /va2/action.php/acars/data HTTP/1.1" 200 970 "-" "Mozilla/5.0 (Windows NT 6.0; en-US; rv:27.0) Gecko/20100101 Firefox/27.0"

11026 mysql 20 0 1173352 150116 8304 S 64.0 7.2 74:55.88 mysqld

If two pilots do the same flight with the same flightnumber there will be only one shown see screenshot. You can see a red line between Airport EDDF and my position that happend after the 2nd pilot started the same flight(only 1 plane was visible). Is it possible to diffear plane data by pilot id and not flight number? unbenannt

By the way awesome work, its nice to see such a great work, thank a lot for sharing it :)

Ysurac commented 8 years ago
gugaua commented 8 years ago

Do I only need to delete or rename countries via mysql-client to make it work if I dont want to upgrade to 5.6? I think I will just upgrade mysql to 5.6 which will make it possible to use all features.

Here is the Value of MinFetch 15 Sec. // MINIMUM TIME BETWEEN UPDATES FOR HTTP SOURCES (in seconds) $globalMinFetch = '15';

The source is on the same server "phpvms" $globalSources = array(array('host' => 'http://mywebsite/action.php/acars/data','port' => '80','name' => '','format' => 'phpvmacars','sourcestats' => FALSE));

It would be nice if we can do the same flight with 2 pilots(pilot ids) for example group flight.

Ysurac commented 8 years ago
gugaua commented 8 years ago

I did a fresh install and upgraded mysql to 5.6 I cannot see any traffic anymore on the map

I get only this output www-data@kd56398:~/html/map/scripts$ php5 daemon-spotter.php Connecting... Connect to phpvmacars source (http://www.fscva.net/va2/action.php/acars/data)... Connected! SCAN MODE

*** New aircraft hex : 303032 ***

and nothing else is happening further and no traffic on map

Ysurac commented 8 years ago

Your source seems to send an empty result: http://www.fscva.net/va2/action.php/acars/data

gugaua commented 8 years ago

I discovered that when I start the daemon-spotter, the flights are disappearing until I kill it

Ysurac commented 8 years ago

True, I have a bug. I try to find it...

Ysurac commented 8 years ago

Fixed in latest commit.

gugaua commented 8 years ago

Because phpvms is not working well with mysql server 5.6 I decided to create an extra server for FlightAirMap. I wanted to install the new database via WEBUI on remote server but I get the following error

[Thu Oct 20 20:53:18.287721 2016] [:error] [pid 4935] [client 1.2.3.4:58371] PHP Fatal error: Call to a member function prepare() on null in xxx/install/class.create_db.php on line 19, referer: http://xxx/map/install/index.php?1351574133&next=database_create

Ysurac commented 8 years ago

It's because it can't connect to db.

gugaua commented 8 years ago

Okay now it is connected to DB flight will be shown but not 3D Map, there is only a white site http://fscva.net/map/

Ysurac commented 8 years ago

The problem is that $globalCenterLatitude & $globalCenterLongitude is set to ''. This is fixed in latest commit.

gugaua commented 8 years ago

Genius, IT WORKS thank you for the super fast response I am speechless

Danke Sehr für die tolle Hilfe!!! :) :) :)

gugaua commented 8 years ago

I found another issue

if there is a value for $globalAircraftSize = ''; dynamic plane movement does not work, like now

gugaua commented 8 years ago

daemon-spotter.php is using 100% cpu and 3D map does not show any planes anymore

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1841 www-data 20 0 279708 18796 8756 R 99.8 0.4 4:20.73 php5

Ysurac commented 8 years ago
Ysurac commented 8 years ago

I have the same problem with phpvms with the CPU, I check that.

gugaua commented 8 years ago

O yes, once I had a . and once a , I changed both to . and it works like a charm.

i7-3770 CPU @ 3.40GHz

Ysurac commented 8 years ago

CPU usage is fixed in latest commit.

gugaua commented 8 years ago

CPU usage is ok.

okay new work for you :)

  1. if I zoom in and move the map, map stops moving.
  2. If planes are near to each other, you will select both of them like now

unbenannt2

Ysurac commented 8 years ago
gugaua commented 8 years ago

okay updated and everything works well except plane movement, I will keep testing that map is great :)

Ysurac commented 8 years ago

Movement is calculated using the value of $globalMapRefresh, but if this value is too short flights don't move. Try to increase it. This part will be changed soon.

gugaua commented 8 years ago

Do you support Virtual Airlines Manager? http://virtualairlinesmanager.net/

gugaua commented 8 years ago

updating METAR...METAR are only updated every hours.

Metar are being release every 30 minutes but can only be updated every hour.

its like 00:20, 00:50. 01:20, 01:50...

Ysurac commented 8 years ago
gugaua commented 8 years ago

there is always an error at updating NOTAM...NOTAM from FlightAirMap website : Download...Gunzip...Add to DB...ERROR : Q)WIARADIUSOF1NMANDAMAXHGTOF375FTAMSL.325FTAGL with update_db

Is there an option to see aircrafts already on ground? they will appear shortly after takeoff

I set $globalMapRefresh to 30, but it is still not working(dynamic plane movement)

Since the latest commit I cannot access airports anymore http://map.fscva.net/airport/EDDM

bilkaPek commented 8 years ago

Hello. putting in settings.php a line 83 change the value ( "0" zero)

// MINIMAL CHANGE TO PUT IN DB
$globalCoordMinChange = '0'; // minimal change since last message for latitude/longitude (limit write to DB)
gugaua commented 8 years ago

Okay line changed but no effect.

And airport information will open BUT it will take about 5 min to open

bilkaPek commented 8 years ago

the change is to see the aircraft on the ground not for metar what is your source for traffic (PHPVms) ?

gugaua commented 8 years ago

yes, phpvms you need to see the data for the aircraft on the ground?

Ysurac commented 8 years ago

The error with NOTAM s not a problem. Only a bad formatted NOTAM. True for globalCoordMinChange, if there is info from aircraft on ground you will see them. For airport page you try latest commit. This can be better... or not...

gugaua commented 8 years ago

daemon spotter tells me *** New aircraft hex : 303033 *** but there is no further DATA until takeoff

phpvms shows me and there is lat and lng

[{"id":"1","pilotid":"DFA0007","flightnum":"FSC0003","pilotname":"Gugs Auster","aircraft":"4","lat":"50.04469764387","lng":"8.5648204844018","heading":"159","alt":"372","gs":"0","depicao":"EDLP","depapt":"Paderborn Lippstadt Airport","arricao":"EDDF","arrapt":"Frankfurt am Main International","deptime":"12:26:13","timeremaining":"00:00","arrtime":"12:26:13","route":"","route_details":[],"distremain":"1","phasedetail":"Boarding","online":"","lastupdate":"2016-10-23 12:26:13","client":"CCFTracker Free","aircraftname":"B737-800","registration":"4","code":"DFA","firstname":"Gugs","lastname":"Auster","depname":"Paderborn Lippstadt Airport","deplat":"51.6141","deplng":"8.61632","arrname":"Frankfurt am Main International","arrlat":"50.0414","arrlng":"8.58006","distremaining":"1"},

I am on latest commit now, there was nothing to update

Ysurac commented 8 years ago

Commited now. True, I don't add to DB data that are exactly the same. This is never the case for real flight, but often the case for VA. Need to find a way to add them without adding thousands of line in DB...

Ysurac commented 8 years ago

In latest commit I add data if lastupdate is not the same, so this should work when flight is on ground.

gugaua commented 8 years ago

latest commit killed the daemon PHP Parse error: syntax error, unexpected '$data' (T_VARIABLE) in /var/www/map/scripts/daemon-spotter.php on line 391

bilkaPek commented 8 years ago

change to the line 371 indaemon-spotter.php value 30 by 41

if (count($line) > 30 && $line[0] != 'callsign') {

gugaua commented 8 years ago

done, PHP Parse error: syntax error, unexpected '$data' (T_VARIABLE) in /var/www/map/scripts/daemon-spotter.php on line 391

Ysurac commented 8 years ago

I forget a ;, fixed in latest commit

bilkaPek commented 8 years ago

yes it is that it accounts the line the value 30 to the line 371 daemon-spotter.php by default not corespont the schema to whazzup.txt

Ysurac commented 8 years ago

It's not a problem, I check if there is more than that.

gugaua commented 8 years ago

more than 2 hours passed, and I cannot update METAR updating METAR...METAR are only updated every hours.

is there something I can do for dynamic plane movement?

Ysurac commented 8 years ago
gugaua commented 8 years ago

+----+----------------------+---------------------+ | id | name | value | +----+----------------------+---------------------+ | 1 | schema_version | 26 | | 4 | last_update_tle | 2016-10-21 14:30:35 | | 6 | last_update_notam_db | 2016-10-23 09:55:32 | | 7 | last_update_metar | 2016-10-23 10:00:09 | +----+----------------------+---------------------+

Ysurac commented 8 years ago

And what is your local time ?

gugaua commented 8 years ago

13:58

gugaua commented 8 years ago

the two buttons below "-" Plot your Location and Compass Mode are not doing anything unbenannt3