throw new Syj_Exception_InvalidGeomUpload();
}
+ // merge linestrings for gpx containting multiple trkseg elements.
+ if ($classname == 'gisconverter\\GPX' && $geom::name == 'GeometryCollection') {
+ $geomstring = "";
+ foreach (array_filter($geom->components, function ($geom) {
+ return $geom::name == "LineString";
+ }) as $linestring) {
+ $geomstring .= str_replace("<trkseg>", "",
+ str_replace("</trkseg>", "", $linestring->toGPX()));
+ }
+ $geom = $decoder->geomFromText("<trkseg>" . $geomstring . "</trkseg>");
+ }
+
if ($geom::name != "LineString") {
- throw new Syj_Exception_Request();
+ throw new Syj_Exception_InvalidGeomUpload();
}
$path->geom = $geom;
/* now, saving !*/
$pathMapper = new Syj_Model_PathMapper();
- try {
- $pathMapper->save ($path);
- } catch(Zend_Db_Statement_Exception $e) {
- if ($e->getCode() == 23505) { // 23505: Unique violation throw new Syj_Exception_Request();
- $message = $e->getMessage();
- if (strpos($message, 'paths_geom_key') !== false) {
- throw new Syj_Exception_Request("uniquepath");
- } else {
- throw $e;
- }
- } else {
- throw $e;
- }
- }
+ $pathMapper->save ($path);
}
}