php igc patch

There is a realy powerfull tool to convert igc files into gmap polygons or whatever you want, called PHP IGC ( official site here: https://sourceforge.net/projects/php-igc/)

But there is just a little problem with the setDetails method which has a statement like:

  1. if (is_array($this->records)) {
  2. foreach ($this->records as $each) {
  3. if ($each['type'] == 'B') {
  4. if ($each['pressure_altitude']>$this->max_altitude) {
  5. $this->max_altitude = $each['pressure_altitude'];
  6. } elseif ($each['pressure_altitude'] < $this->min_altitude) {
  7. $this->min_altitude = $each['pressure_altitude'];
  8. }
  9. }
  10. }
  11. }

You need to change it to

  1. if ($each->type == 'B') {
  2. if ($each->pressure_altitude>$this->max_altitude) {
  3. $this->max_altitude = $each->pressure_altitude;
  4. } elseif ($each->pressure_altitude< $this->min_altitude) {
  5. $this->min_altitude = $each->pressure_altitude;
  6. }
  7. }

because $each property is not an array, it's an object. hope this helps someone.

Cevapla

Bu alanın içeriği gizli tutulacak ve açıkta gösterilmeyecektir.
 .