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

Airspace problems #353

Closed daviessm closed 6 years ago

daviessm commented 6 years ago

Initial install script doesn't install airspace data (it's commented out in install-action.php)

Selecting waypoints or airspace in the filters list on the main page doesn't save the options or refresh; on refresh they return to unchecked.

I have $globalWaypoints = TRUE;

Ysurac commented 6 years ago

Airspace data are installed via scripts/update_db.php. I don't save waypoints and airspace filter setting because they can use lot of resources, and I don't think it's needed to keep them.

daviessm commented 6 years ago

Ok, despite running update_db.php every hour it hadn't created the table. I ran it manually and it did so that's solved.

However when ticking the airspace layer, nothing happens. No JS errors or anything until I zoom or move the map, at which point I get these respectively:

Uncaught ReferenceError: airspaceLayer is not defined
    at e.<anonymous> (map-aircraft.2d.js.php?1507120429:109)
    at e.fire (leaflet.js:5)
    at e._moveEnd (leaflet.js:5)
    at e.<anonymous> (leaflet.js:5)

Uncaught ReferenceError: airspaceLayer is not defined
    at e.<anonymous> (map-aircraft.2d.js.php?1507120429:109)
    at e.fire (leaflet.js:5)
    at e._onPanTransitionEnd (leaflet.js:5)
    at e.fire (leaflet.js:5)
    at e._complete (leaflet.js:5)
    at e._step (leaflet.js:5)
    at e._animate (leaflet.js:5)
Ysurac commented 6 years ago
daviessm commented 6 years ago

Even if I zoom out all the way the airspace layer isn't displayed. No errors before these. Browser is Chrome 61 on Windows.

I can't see anywhere in the code that creates airspaceLayer, only removes it.

Ysurac commented 6 years ago

You can try latest commit. Maybe this will solve the error, but I don't think so...

daviessm commented 6 years ago

That did something, now I'm getting a 500 error from airspace-geojson.php?coord=-30.761718750000004,48.980216985374994,52.86621093750001,60.54377524118842

If you don't get around to it I'll debug this later.

Ysurac commented 6 years ago

It's better. What DB do you use MySQL ? MariaDB ? PostgreSQL ? And what version ?

daviessm commented 6 years ago

MariaDB:

mysql Ver 15.1 Distrib 10.1.26-MariaDB, for Linux (armv7l) using readline 6.3

Ysurac commented 6 years ago

So this should have spatial support. Strange... I will make some tests with the same mariadb version.

daviessm commented 6 years ago

Well this could explain it...

PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 4096 bytes) in /var/www/planes/htdocs/FlightAirMap/require/libs/geoPHP/lib/geometry/Point.class.php on line 41

What's it doing that would take up more than 256MiB memory?

Ysurac commented 6 years ago

All is calculated from geometry. It's why airspace is available only when you zoom. This make lot of points. It's not the best way to do but it's the only way I find to do that :)

daviessm commented 6 years ago

That makes sense. However I increased the max memory to 512MiB and it doesn't give a 500 error but returns nothing instead! I'll look at it more when I get home.

Is it calculating the points in 2D or 3D?

Ysurac commented 6 years ago

2D

daviessm commented 6 years ago

Got it. At least in my version of PHP, line 64 of airspace-geojson.php tries to remove the 'shape' attribute of the geo objects, but doesn't because SHAPE is capitalised. If I change it to unset($properties['shape']); the json_encode at the end of the file works. Previously it was returning an empty string.

Ysurac commented 6 years ago

True thanks. I lowered case of all column name and this was not modified...

daviessm commented 6 years ago

Do you download the airspace DB from somewhere? It seems to be missing Irish data. No biggie though.

Ysurac commented 6 years ago

From soaringweb.org, But I may have make some error on import. I will look at it

Ysurac commented 6 years ago

Seems to be XCSoar for latest airspace version. I will update that. I opened bug #357