mygps log filename is no longer hardcoded
authorBenoit Papillault <benoit.papillault@free.fr>
Tue, 28 Jun 2011 14:11:14 +0000 (16:11 +0200)
committerBenoit Papillault <benoit.papillault@free.fr>
Tue, 28 Jun 2011 14:11:14 +0000 (16:11 +0200)
Generates lines instead of points for Google Maps

script-graph-kml

index 3c19a27..cd49b18 100755 (executable)
@@ -1,14 +1,22 @@
 #!/bin/sh
 
-GPS=mygps-boulot.txt
+GPS=mygps-maison.txt
 
-KML="$(basename "${GPS}" .txt).kml"
+create_kml() {
+    GPS="$1"
+    KML="$(basename "${GPS}" .txt).kml"
 
 (
     cat <<EOF
 <?xml version="1.0" encoding="UTF-8"?>
 <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
-<Folder>
+<Placemark>
+       <name>Path</name>
+       <LineString>
+               <extrude>1</extrude>
+               <tessellate>1</tessellate>
+               <altitudeMode>relativeToGround</altitudeMode>
+               <coordinates>
 EOF
 
     nb=0
@@ -25,22 +33,21 @@ EOF
            lon_prev="${lon}"
 
            cat <<EOF
-  <Placemark>
-       <name>${nb}</name>
-       <description>GPS latitude: ${lat}, longitude: ${lon}</description>
-         <gx:balloonVisibility>1</gx:balloonVisibility>
-         <Point>
-               <altitudeMode>clampToGround</altitudeMode>
-               <coordinates>${lon},${lat}</coordinates>
-               </Point>
-  </Placemark>
+                       ${lon},${lat},10
 EOF
        fi
     done
 
     cat <<EOF
-</Folder>
+               </coordinates>
+       </LineString>
+</Placemark>
 </kml>
 EOF
 ) | tee "${KML}"
+}
+
+for file in $*; do
+    create_kml "${file}"
+done