line_coords[] = [$lon, $lat]; if(array_key_exists('alt', $attrs)) { $point[] = $attrs['alt']; } $this->point_coords[] = new Feature(new Point($point), $attrs); ++$this->counter; } /** * Get the FeatureCollection for the line * @return FeatureCollection */ public function getLine(): FeatureCollection { if (empty($this->line_coords) || \count($this->line_coords) < 2) { return new FeatureCollection([]); } return new FeatureCollection([ new Feature(new LineString($this->line_coords)) ]); } /** * Get the feature collection of all the points * @return FeatureCollection */ public function getPoints(): FeatureCollection { return new FeatureCollection($this->point_coords); } }