Skip to content

Commit

Permalink
ignore invalid trkseg-entries in GPX (ex. only one point)
Browse files Browse the repository at this point in the history
  • Loading branch information
swen100 committed Feb 26, 2018
1 parent 37908c5 commit 074ad09
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Adapter/GPX.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,16 @@ protected function parseTracks($xmlObject)
/** @noinspection SpellCheckingInspection */
$points[] = $this->parsePoint($trkpt);
}
$lines[] = new LineString($points);
if (count($points)>1) {
$lines[] = new LineString($points);
}
}
if (!empty($lines)) {
$multiLine = new MultiLineString($lines);
$multiLine->setData($this->parseNodeProperties($trk, $this->gpxTypes->get('trkType')));
$multiLine->setData('gpxType', 'track');
$collection[] = $multiLine;
}
$multiLine = new MultiLineString($lines);
$multiLine->setData($this->parseNodeProperties($trk, $this->gpxTypes->get('trkType')));
$multiLine->setData('gpxType', 'track');
$collection[] = $multiLine;
}
return $collection;
}
Expand Down

0 comments on commit 074ad09

Please sign in to comment.