You are here

private function GPX::linestringToGPX in geoPHP 8

Same name and namespace in other branches
  1. 7 geoPHP/lib/adapters/GPX.class.php \GPX::linestringToGPX()
1 call to GPX::linestringToGPX()
GPX::geometryToGPX in geoPHP/lib/adapters/GPX.class.php

File

geoPHP/lib/adapters/GPX.class.php, line 158

Class

GPX
PHP Geometry/GPX encoder/decoder

Code

private function linestringToGPX($geom) {
  $gpx = '<' . $this->nss . 'trk><' . $this->nss . 'trkseg>';
  foreach ($geom
    ->getComponents() as $comp) {
    $gpx .= '<' . $this->nss . 'trkpt lat="' . $comp
      ->getY() . '" lon="' . $comp
      ->getX() . '" />';
  }
  $gpx .= '</' . $this->nss . 'trkseg></' . $this->nss . 'trk>';
  return $gpx;
}