diff --git a/lib/adapters/KML.class.php b/lib/adapters/KML.class.php index 8be9f680..0730a218 100644 --- a/lib/adapters/KML.class.php +++ b/lib/adapters/KML.class.php @@ -224,6 +224,16 @@ private function pointToKML($geom) { private function linestringToKML($geom, $type = FALSE) { if (!$type) { $type = $geom->getGeomType(); + + if ($type === 'LineString') { + $components = $geom->getComponents(); + $firstPoint = array_shift($components); + $lastPoint = array_pop($components); + + if ($firstPoint->equals($lastPoint)) { + $type = 'LinearRing'; + } + } } $str = '<'.$this->nss . $type .'>';