]> dev.renevier.net Git - syj.git/commitdiff
gpx export
authorarno <arno@renevier.net>
Wed, 25 Aug 2010 10:02:43 +0000 (12:02 +0200)
committerarno <arno@renevier.net>
Wed, 25 Aug 2010 10:02:43 +0000 (12:02 +0200)
application/controllers/GeomController.php
library/gisconverter

index f97d016c554ee0f950723d97b8c920c7395cd01e..3f14df907137d7cbab2ec8a83f695ba3d140b653 100644 (file)
@@ -67,6 +67,22 @@ class GeomController extends Zend_Controller_Action
         $api->setCheckIfNoneMatch(true)->setContentType('application/vnd.google-earth.kml+xml')->setBody($data);
     }
 
+    protected function gpx(Syj_Model_Path $path) {
+        $data = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;   // <? <-- vim syntax goes crazy
+        $data .= '<gpx creator="syj" version="1.0" xmlns="http://www.topografix.com/GPX/1/0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">';
+        $data .= '<trk>';
+        if ($path->creator) {
+            $data .= '<author>' . htmlspecialchars($path->creator->pseudo) . '</author>';
+        }
+        $data .= '<name>' . htmlspecialchars($path->displayTitle) . '</name>';
+        $data .= $path->geom->toGPX();
+        $data .= '</trk>';
+        $data .= '</gpx>';
+
+        $api = $this->_helper->SyjApi;
+        $api->setCheckIfNoneMatch(true)->setContentType('application/octet-stream')->setBody($data);
+    }
+
     protected function json(Syj_Model_Path $path) {
         $data = array('geom' => (string)$path->geom,
                   'title' => (string)$path->displayTitle);
index 063610dca1ee201535e71a63b9e4b5ae92add507..bcbe8cfed228ed3f5bb13a53ae166ee925ffc417 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 063610dca1ee201535e71a63b9e4b5ae92add507
+Subproject commit bcbe8cfed228ed3f5bb13a53ae166ee925ffc417