private function KML::linestringToKML in geoPHP 8
Same name and namespace in other branches
- 7 geoPHP/lib/adapters/KML.class.php \KML::linestringToKML()
2 calls to KML::linestringToKML()
- KML::geometryToKML in geoPHP/
lib/ adapters/ KML.class.php - KML::polygonToKML in geoPHP/
lib/ adapters/ KML.class.php
File
- geoPHP/
lib/ adapters/ KML.class.php, line 212
Class
- KML
- PHP Geometry/KML encoder/decoder
Code
private function linestringToKML($geom, $type = FALSE) {
if (!$type) {
$type = $geom
->getGeomType();
}
$str = '<' . $this->nss . $type . '>';
if (!$geom
->isEmpty()) {
$str .= '<' . $this->nss . 'coordinates>';
$i = 0;
foreach ($geom
->getComponents() as $comp) {
if ($i != 0) {
$str .= ' ';
}
$str .= $comp
->getX() . ',' . $comp
->getY();
$i++;
}
$str .= '</' . $this->nss . 'coordinates>';
}
$str .= '</' . $this->nss . $type . '>';
return $str;
}