TangoGPS

From Openmoko

(Difference between revisions)
Jump to: navigation, search
m (Add usage notes on the POI to gpx conversion script.)
(Converting tangogps's POI into OSM xml files(importable into JOSM): change to GPLv2+ in order to be compatible with foxtrot-gps license)
 
(9 intermediate revisions by 7 users not shown)
Line 4: Line 4:
 
{{ApplicationBox|
 
{{ApplicationBox|
 
Name=[[TangoGPS]]|
 
Name=[[TangoGPS]]|
Description=    TangoGPS is a map application which can utilize Neo's built-in GPS to show your current location. It automatically downloads maps from http://openstreetmap.com and you can download map tiles for offline use too.|
+
Description=    TangoGPS is a map application which can utilize Neo's built-in GPS to show your current location. It automatically downloads maps from http://openstreetmap.com and you can download map tiles for offline use too. There is also a fork of TangoGPS - [[FoxtrotGPS]], which can be alternatively installed and has more open development. The feature sets are quite close.|
 
Screenshot=TangoGPS1.jpg|
 
Screenshot=TangoGPS1.jpg|
 
Homepage=http://www.tangogps.org|
 
Homepage=http://www.tangogps.org|
Line 90: Line 90:
 
=== pre-load for offline use ===
 
=== pre-load for offline use ===
  
tangoGPS can bunch-download the map images so you don't need an internet connection while walking around. By default tangoGPS stores downloaded maps to /tmp/. This folder is lost every time you reboot the device. But you can use the "Config" tab within tangoGPS to change the "Cache Dir" location to , for example, /osm/ . So downloaded maps will be kept in the Neos flash, also after reboot. Note that the map files can take up large amounts of space, so you may want to store them on your sd card, e.g. in /media/card/osm or /media/mmcblk0p2/data/maps.
+
tangoGPS can bunch-download the map images so you don't need an internet connection while walking around. They are stored in ~/maps folder, this can be changed in settings. Note that the map files can take up large amounts of space, so you may want to store them on your sd card, e.g. in /media/card/osm or /media/mmcblk0p2/data/maps.
  
 
If you find that TangoGPS does not remember configuration changes that you make to it, be sure to run it from the touchscreen, and not an SSH session.  TangoGPS uses gconf to store its settings, and cannot access gconf when run via SSH.
 
If you find that TangoGPS does not remember configuration changes that you make to it, be sure to run it from the touchscreen, and not an SSH session.  TangoGPS uses gconf to store its settings, and cannot access gconf when run via SSH.
Line 123: Line 123:
 
== Using tangoGPS for OpenStreetMap.org ==
 
== Using tangoGPS for OpenStreetMap.org ==
 
=== creating tracks ===
 
=== creating tracks ===
 +
Step by step guide to use TangoGPS for contributing to OSM can be found here: [http://www.tangogps.org/gps/articles/13-Howto-contribute-to-OpenStreetMap.html]
 +
 
tangoGPS works fine to create track for Openstreetmap. However, it records and stores a track in its native format, use [http://www.tangogps.org/downloads/convert2gpx.pl convert2gpx.pl] (see also: [http://psung.blogspot.com/2008/07/sharing-gps-tracks-from-tangogps-on.html tools])(you can also use [http://minucci.net/file/convert2gpx.py convert2gpx.py]) to convert the track to GPX (i.e to import into JOSM):
 
tangoGPS works fine to create track for Openstreetmap. However, it records and stores a track in its native format, use [http://www.tangogps.org/downloads/convert2gpx.pl convert2gpx.pl] (see also: [http://psung.blogspot.com/2008/07/sharing-gps-tracks-from-tangogps-on.html tools])(you can also use [http://minucci.net/file/convert2gpx.py convert2gpx.py]) to convert the track to GPX (i.e to import into JOSM):
  
Line 234: Line 236:
 
If you would like to import GeoRSS feeds from Google maps or elsewhere as points of interest (POI), read this [http://bonedaddy.net/pabs3/log/2009/05/28/georss-tangogps/ blog post]. Hopefully TangoGPS upstream will include the script soon, but until then and if you aren't using Debian, download this [http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=georss-to-tangogps-poi.py;att=1;bug=530718 script] from the Debian bug tracker.
 
If you would like to import GeoRSS feeds from Google maps or elsewhere as points of interest (POI), read this [http://bonedaddy.net/pabs3/log/2009/05/28/georss-tangogps/ blog post]. Hopefully TangoGPS upstream will include the script soon, but until then and if you aren't using Debian, download this [http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=georss-to-tangogps-poi.py;att=1;bug=530718 script] from the Debian bug tracker.
  
== Converting tangogps's POI into gpx files(importable into JOSM) ==
+
== Converting tangogps's POI into OSM xml files(importable into JOSM) ==
 
You need to have the package python-sqlalchemy. On Debian/Ubuntu do:
 
You need to have the package python-sqlalchemy. On Debian/Ubuntu do:
 
<pre>
 
<pre>
Line 240: Line 242:
 
</pre>
 
</pre>
  
Start this script in a directory where you have the poi.db file from TangoGPS (on the FR it is located in ~/.tangogps). Redirect the output into a .gpx file. For example:
+
Start this script in a directory where you have the poi.db file from TangoGPS (on the FR it is located in ~/.tangogps). Redirect the output into a .osm file. For example:
 
<pre>
 
<pre>
 
scp root@neo:.tangogps/poi.db .
 
scp root@neo:.tangogps/poi.db .
./poi2gpx > poi.gpx
+
./poi2osm > poi.osm
 
</pre>
 
</pre>
 +
 +
The file can then be opened in JOSM.
  
 
<pre>
 
<pre>
Line 251: Line 255:
 
  #Copyright (C) 2009  Denis 'GNUtoo' Carikli
 
  #Copyright (C) 2009  Denis 'GNUtoo' Carikli
 
  #
 
  #
  #This program is free software: you can redistribute it and/or modify
+
  #This program is free software; you can redistribute it and/or modify
 
  #it under the terms of the GNU General Public License as published by
 
  #it under the terms of the GNU General Public License as published by
  #the Free Software Foundation, either version 3 of the License, or
+
  #the Free Software Foundation; either version 2 of the License, or
 
  #(at your option) any later version.
 
  #(at your option) any later version.
 
  #
 
  #
Line 261: Line 265:
 
  #GNU General Public License for more details.
 
  #GNU General Public License for more details.
 
  #
 
  #
  #You should have received a copy of the GNU General Public License
+
  #You should have received a copy of the GNU General Public License along
  #along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
  #with this program; if not, write to the Free Software Foundation, Inc.,
  #
+
  #51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 +
 
 
   
 
   
 
  from sqlalchemy import *
 
  from sqlalchemy import *
Line 303: Line 308:
 
  print "  </node>"
 
  print "  </node>"
 
  print "</osm>"
 
  print "</osm>"
<pre>
+
</pre>
  
 
== Using Google Maps with tangoGPS ==
 
== Using Google Maps with tangoGPS ==
Line 322: Line 327:
 
<pre>
 
<pre>
 
Maps:                                                                                                                                               
 
Maps:                                                                                                                                               
http://mt3.google.com/mt/v=w2.89&hl=en&x=%d&y=%d&z=%d&s=Galileo                                                                                  
+
http://mt0.google.com/vt/lyrs=m@120&hl=en&x=%d&y=%d&z=%d&;s=Galileo
                                                                                                                                                 
+
 
Sat:                                                                                                                                               
 
Sat:                                                                                                                                               
 
http://khm3.google.com/kh/v=36&hl=en&x=%d&y=%d&z=%d&s=Galileo
 
http://khm3.google.com/kh/v=36&hl=en&x=%d&y=%d&z=%d&s=Galileo
Line 330: Line 334:
 
'''Generalization:''' The above 'Maps' URL isn't the current one anymore, also. Google changes the URL layout sometimes. To find out the current scheme open maps.google.com and view the page source. Search for http:// until you find sth similar to the above URL. This way I found
 
'''Generalization:''' The above 'Maps' URL isn't the current one anymore, also. Google changes the URL layout sometimes. To find out the current scheme open maps.google.com and view the page source. Search for http:// until you find sth similar to the above URL. This way I found
 
<pre>
 
<pre>
http://mt1.google.com/mt/v=w2.92&amp;hl=en&amp;x=3&amp;y=5&amp;z=4&amp;s=Galile
+
http://mt0.google.com/vt/lyrs=m@120&hl=en&x=%d&y=%d&z=%d&;s=Galileo
 
</pre>
 
</pre>
  
Line 341: Line 345:
 
0,Opencyclemap|http://a.andy.sandbox.cloudmade.com/tiles/cycle/%d/%d/%d.png|/media/mmcblk0p2/data/maps/opencyclemap|\
 
0,Opencyclemap|http://a.andy.sandbox.cloudmade.com/tiles/cycle/%d/%d/%d.png|/media/mmcblk0p2/data/maps/opencyclemap|\
 
0,Google Sat (testing only)|http://khm1.google.com/kh?v=34&hl=en&x=%d&s=&y=%d&z=%d|/media/mmcblk0p2/data/maps/googlesat|\
 
0,Google Sat (testing only)|http://khm1.google.com/kh?v=34&hl=en&x=%d&s=&y=%d&z=%d|/media/mmcblk0p2/data/maps/googlesat|\
0,Google Maps (testing only)|http://mt1.google.com/mt/v=w2.92&hl=en&x=%d&y=%d&z=%d&s=Galile|/media/mmcblk0p2/data/maps/googlemaps|1]" \
+
0,Google Maps (testing only)|http://mt0.google.com/vt/lyrs=m@120&hl=en&x=%d&y=%d&z=%d&;s=Galileo|/media/mmcblk0p2/data/maps/googlemaps|1]" \
 
--type list --list-type string
 
--type list --list-type string
 
</pre>
 
</pre>
 +
 +
== Updating to the newest version ==
 +
 +
As mentioned in the thread http://lists.openmoko.org/pipermail/community/2009-November/thread.html#57478 it is possible to update to the latest version by doing the following steps:
 +
 +
* cd /tmp
 +
* wget http://www.tangogps.org/downloads/tangogps_0.9.8-1_armel.deb
 +
* ar -x tangogps_0.9.8-1_armel.deb
 +
* tar xfvz data.tar.gz
 +
* scp /tmp/usr/bin/tangogps to_your_phone
 +
 +
or more easy:
 +
 +
* nano /etc/opkg/arch.conf
 +
 +
add 'arch armel 36' (without the quotes) to the bottom of the file and exit and save (CTRL-X, Y, Enter)
 +
 +
* opkg install http://www.tangogps.org/downloads/tangogps_x.yy.z-1_armel.deb-Openmoko
 +
 +
Either way, after that you may get an error
 +
<pre>
 +
root@om-gta02 ~ $ tangogps
 +
tangogps: error while loading shared libraries: libcurl-gnutls.so.4:
 +
cannot open shared object file: No such file or directory
 +
</pre>
 +
A symlink to libcurl.so.4 should help:
 +
* cd /usr/lib
 +
* ln -s libcurl.so.4 libcurl-gnutls.so.4
  
 
[[Category:GPS Applications]]
 
[[Category:GPS Applications]]

Latest revision as of 03:54, 27 January 2012

tangoGPS is one of the applications that runs on the Openmoko Phones. For a list of all applications, visit Applications

TangoGPS1.jpg TangoGPS

TangoGPS is a map application which can utilize Neo's built-in GPS to show your current location. It automatically downloads maps from http://openstreetmap.com and you can download map tiles for offline use too. There is also a fork of TangoGPS - FoxtrotGPS, which can be alternatively installed and has more open development. The feature sets are quite close.


Homepage: http://www.tangogps.org
Package: tangogps
Tested on: Om 2008.8



Contents


tangoGPS is a map application which can utilize Neo's built-in GPS to show your current location.

TangoGPS1.jpg

Website: http://www.tangogps.org


[edit] Running tangoGPS

[edit] Om 2008.8

From the freerunner connected to the internet:

opkg update
opkg install gpsd
NOTE: I experienced hangups if gpsd was not installed.


opkg install http://www.tangogps.org/downloads/tangogps_0.9.5-r0_armv4t.opk

If opkg complains about not being able to acquire a lock, try:

pkill packagekit

To get gpsd working on the FreeRunner you have to change the configuration according to Gpsd#GPS_on_GTA02. Then start gpsd by:

/etc/init.d/gpsd start

If you get an error about no GPS device in /etc/default/gpsd execute:

echo "GPS_DEV=\"/dev/ttySAC1\"" > /etc/default/gpsd

Now you must power up the GPS-chip by opening the "Settings" application and setting the GPS entry to "on". Now you can run tangoGPS and wait until it get's a GPS fix. This can take up to a few minutes.

[edit] Debian

The latest version is available in Debian.

It depends on gpsd which conflicts with frameworkd in fso-frameworkd, but there is a package available that provides the gpsd interface to clients while using the services of the FSO frameworkd daemon, fso-gpsd. The install.sh script for the Debian distribution on the OpenMoko already installs it. To add tangogps run

  1. apt-get install tangogps

The gps device will be started automatically upon the invocation of tangogps or another gps application, e.g. like the one in Zhone. For the records, one can manually turn on the gps device using

  1. echo 1 >/sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0073/neo1973-pm-gps.0/pwron

The tangoGPS applications may appear as "GPS & Map" on various desktops.

Issues:

  • Both gpsd and the framework publish GPS data through dbus, though with different interfaces. This suggests a number of possible solutions.
    • gpsd or the framework could implement the other's interface (along with their own).
    • a translator could read one interface and emulate the other. This is what fso-gpsd does.
    • the framework could have an option to read data from gpsd.
    • ogpsd/gypsy could be extended to be backwards compatible with the majority of gps applications.

[edit] FSO Milestone 3 (OpenmokoFramework)

There are two various GPS interfaces -- (1) one provided with default gpsd and (2) the other provided by ogpsd (part of the frameworkd). tangoGPS requires the ad 1 and it obtains information from gps from the dbus interface provided by gpsd.

On FSO milestone 3, there is tangoGPS pre-installed as well as both gpsd and ogpsd (see /etc/frameworkd.conf, section ogpsd). As mentioned above, there also exists a fso-gpsd package, that converts from ad 2 to ad 1 (unfortunately fso-gpsd is not in default image and must be installed with opkg install fso-gpsd).

You cannot have both "providers" (ad 1 & ad 2) running, but you can have ad 2 (recommended for FSO) and "convertor" (fso-gpsd) providing the ad 1. To get usable tangoGPS on FreeRunner, one has to:

  1. check that /etc/frameworkd.conf, section ogpsd reads GPS data from the right device (/dev/ttySAC1)
  2. if changes were made to configuration, one should restart the frameworkd -- /etc/init.d/frameworkd stop && /etc/init.d/frameworkd start
  3. check that gpsd is not running -- /etc/init.d/gpsd stop
  4. check that fso-gpsd is installed and running -- opkg install fso-gpsd; fso-gpsd
  5. check that gps chip is online (echo 1 > /sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0073/neo1973-pm-gps.0/pwron) (Om 2009 newer kernels: echo 1 > /sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-regltr.7/neo1973-pm-gps.0/power_on)
  6. finally start up the tangoGPS and locate the gps signal; it should be up in a few minutes.

Note 1: handy application for testing the gps (and gps signal strength) is openmoko-agpsui, see general gps info at Gps

Note 2: You can automate the process -- (1) remove the startup script for gpsd (update-rc.d -f gpsd remove) and (2) create a simple startup scipt for fso-gpsd (you can use current script for gpsd as a skeleton)

[edit] Downloading Maps

[edit] pre-load for offline use

tangoGPS can bunch-download the map images so you don't need an internet connection while walking around. They are stored in ~/maps folder, this can be changed in settings. Note that the map files can take up large amounts of space, so you may want to store them on your sd card, e.g. in /media/card/osm or /media/mmcblk0p2/data/maps.

If you find that TangoGPS does not remember configuration changes that you make to it, be sure to run it from the touchscreen, and not an SSH session. TangoGPS uses gconf to store its settings, and cannot access gconf when run via SSH.

An alternative way to setup the configuration is through the command line. having /media/mmcblk0p2/data/maps as your data directory you could do the following:

gconftool-2 -s /apps/tangogps/repos \
"[OSM|http://tile.openstreetmap.org/%d/%d/%d.png|/data/maps/OSM|\
0,Topo|maps-for-free|/data/maps/maps4free|\
0,Aerial|openaerial|/data/maps/openaerial|\
0,Opencyclemap|http://a.andy.sandbox.cloudmade.com/tiles/cycle/%d/%d/%d.png|/data/maps/opencyclemap|\
0,Google Sat (testing only)|http://khm1.google.com/kh?v=34&hl=en&x=%d&s=&y=%d&z=%d|/data/maps/googlesat|1]" \
--type list --list-type string
Om2009 unstable 090805 Glenn:
(gconftool-2:1820): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed.
Error setting value: No D-BUS daemon running
root@om-gta02:~#

Once you have set the location to a non-volatile path, you can connect your Neo to the internet by USB or WiFi at home and start downloading the maps of your area. Tap the map screen and select "map download". Now on-the-road tangoGPS will be able to show you maps in different zoom levels even though you are not connected to the internet.

[edit] Downloading Maps via GPRS

I think tangoGPS may have started working after I followed the instructions to get GPRS working with GSM multiplexing here: Manually_using_GPRS#Option_1:_With_GSM_multiplexing_and_with_a_GUI

There are steps included in those instructions to improve GPS performance. The great thing is that once you get GPRS working, you can roam with TangoGPS running and have it download maps as needed over the GPRS connection!

[edit] Updating pre-downloaded maps

If you have many maps already downloaded, updateMaps.pl is a perl script to bring you up-to-date. It's made to work for OSM maps only, but can be adapted to work with any map dataset. See also: Yaouh!.

[edit] Using tangoGPS for OpenStreetMap.org

[edit] creating tracks

Step by step guide to use TangoGPS for contributing to OSM can be found here: [1]

tangoGPS works fine to create track for Openstreetmap. However, it records and stores a track in its native format, use convert2gpx.pl (see also: tools)(you can also use convert2gpx.py) to convert the track to GPX (i.e to import into JOSM):

perl convert2gpx.pl 20080903_111508.log > 20080903_111508.gpx

[edit] tangoGPS logging format

<lat>,<lon>,<elevation>,<speed>,<course>,<hdop>,<datetime>

[edit] using OpenStreetBugs

see OSM wiki


[edit] Importing Tracks into tangoGPS

tangoGPS does not support the import of tracks directly. However the following xslt style sheet can be used to convert gpx tracks - e.g from routing software such as maps.cloudmade.com - to tangogps log files, which can then be imported

[edit] XSLT

At present this style sheet will only convert tracks which make use of the 'wpt' (waypoint) tag. Some software uses the 'trkpt' (trackpoint) tag. This will be incorporated into the stylesheet at some point. In the meantime, it can be used on the latter type of gpx file by changing 'wpt' to 'trkpt' on line 6.


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:g="http://www.topografix.com/GPX/1/1">
<xsl:output method="text" omit-xml-declaration="yes"/>
<xsl:template match="g:gpx" >
<xsl:for-each select="g:wpt">
<xsl:value-of select="@lat"/>,<xsl:value-of select="@lon"/>,11.8,1.1,346.0,1.4,2008-12-30T06:46:0<xsl:if test="position()!=last()"><xsl:text>1</xsl:text></xsl:if><xsl:if test="position()=last()"><xsl:text>2</xsl:text></xsl:if>Z
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

save this into a file called 'gpx2log.xslt', then run

$ xsltproc gpx2log.xslt input_file.gpx > output_file.log

move output_file.log to the tangogps traces directory, and use the 'Load...' button on the 'Track' tab to overlay it on the map

Note: this stylesheet was thrown together in a short time, and makes at least one shortcut - namely, the use of 'dummy' variables for various details, such as the altitude, date, etc. Feel free to improve this if required, although it has no bearing on the display of the track

[edit] python

This small python script will convert GPX tracks and routes to tangogps file format.


#!/usr/bin/env python

import sys, re
import xml.etree.cElementTree as ET

tree = ET.parse(sys.argv[1])
root = tree.getroot()
ns = re.match('{(.*)}', root.tag).group(1)

for trkpt in root.findall('.//{%s}trkpt' % ns) + root.findall('.//{%s}rtept' % ns):
    a = trkpt.attrib
    for key, default in (('ele', 555.55), ('speed', 1.0), ('hdop', 1.0), ('course', 0.0), ('time', '2009-05-16T09:35:58Z')):
        a[key] = trkpt.findtext('{%s}%s' % (ns, key)) or default
    print '%(lat)s,%(lon)s,%(ele)s,%(speed)s,%(hdop)s,%(time)s' % a


Testet with GPX files from bikemap.net, gpsies.com, bikeroutetoaster.com, www.vvs.de/radroutenplaner.

Usage:

$ ./gpx2tango.py MyTack.gpx > MyTrack.log

[edit] sqlite

You may help yourself by using this tool to import GPX trackpoints as a series of POIs directly into the sqlite database which tangoGPS uses to store POIs.

[edit] Using the TangoGPS logs

You can convert the logfiles from TangoGPS to other formats using gpsbabel and this style-file:

DESCRIPTION TangoGPS 0.92
EXTENSION log
DATATYPE TRACK

FIELD_DELIMITER COMMA
RECORD_DELIMITER NEWLINE

IFIELD LAT_DECIMAL,"","%f"
IFIELD LON_DECIMAL,"","%f"
IFIELD ALT_METERS,"","%f"
IFIELD PATH_SPEED,"","%f"
IFIELD PATH_COURSE,"","%f"
IFIELD GPS_HDOP,"","%f"
IFIELD ISO_TIME,"","%s" 

Save this as tangogps.style and you can use gpsbabel to for instance convert to google-earth files like this:

gpsbabel -i xcsv,style=tangogps.style -o kml -f file.log -F file.kml

[edit] Add POI from address

You can use gtkaddpoi for searching the destination address and add it as a POI.

[edit] Add POI from GeoRSS feed

If you would like to import GeoRSS feeds from Google maps or elsewhere as points of interest (POI), read this blog post. Hopefully TangoGPS upstream will include the script soon, but until then and if you aren't using Debian, download this script from the Debian bug tracker.

[edit] Converting tangogps's POI into OSM xml files(importable into JOSM)

You need to have the package python-sqlalchemy. On Debian/Ubuntu do:

sudo apt-get install python-sqlalchemy

Start this script in a directory where you have the poi.db file from TangoGPS (on the FR it is located in ~/.tangogps). Redirect the output into a .osm file. For example:

scp root@neo:.tangogps/poi.db .
./poi2osm > poi.osm

The file can then be opened in JOSM.

 #!/usr/bin/env python
 #poi2osm convert a sqlite poi database comming from tangps to a file you can import in JOSM
 #Copyright (C) 2009  Denis 'GNUtoo' Carikli
 #
 #This program is free software; you can redistribute it and/or modify
 #it under the terms of the GNU General Public License as published by
 #the Free Software Foundation; either version 2 of the License, or
 #(at your option) any later version.
 #
 #This program is distributed in the hope that it will be useful,
 #but WITHOUT ANY WARRANTY; without even the implied warranty of
 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 #GNU General Public License for more details.
 #
 #You should have received a copy of the GNU General Public License along
 #with this program; if not, write to the Free Software Foundation, Inc.,
 #51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

 
 from sqlalchemy import *
 from sqlalchemy.orm import *
 
 class Poi(object):
 	def __init__(self,id,longitude,latitude,unk1,unk2,unk3,description,unk4,unk5,unk6,unk7,unk8,unk9,unk10,unk11):
 		self.id = id
 	def __repr__(self):
 		print repr(self.id)
 
 
 engine = create_engine('sqlite:///poi.db')
 session = create_session(bind=engine)
 metadata = MetaData('sqlite://')
 poi_table = Table("poi",metadata,
     Column('idmd5', Integer, primary_key=True),
     Column('lat', Integer),
     Column('lon', Integer),
     Column('visibility', Integer),
     Column('cat', Integer),
     Column('subcat', Integer),
     Column('keywords', String),
     Column('desc', String),
     Column('price_range',Integer),
     Column('extended_open', Integer),
     Column('creator', String),
     Column('bookmarked', String),
     Column('user_rating', String),
     Column('rating', String),
     Column('user_comment', String),
     )
 mapper(Poi, poi_table)
 
 print "<osm version=\"0.5\">"
 for poi in session.query(Poi).all():
 	print "  <node id=\""+ str(poi.idmd5) + "\" lat=\"" + str(poi.lat)  + "\" lon=\"" + str(poi.lon)  +  "\">"
 	print "    <tag k=\"name\" v=\""+ poi.keywords  +"\"/>"
 	print "  </node>"
 print "</osm>"

[edit] Using Google Maps with tangoGPS

Go to Config and create a new repository.

Set the url for street-maps to:

http://mt1.google.com/mt?&x=%d&y=%d&z=%d

for satellite-maps to:

http://khm.google.com/kh?&x=%d&y=%d&zoom=%d

for topographic-maps:

http://mt.google.com/mt?v=app.81&x=%d&y=%d&zoom=%d

Check the "Inverted Zoom" box. Press save Repository Configuration and you're ready to go.


Since TangoGPS 0.9.5 the "Inverted Zoom" box is no longer available because Google changed the addressing scheme; instead, select "xyz instead of zxy" and use the following URLs:

Maps:                                                                                                                                              
http://mt0.google.com/vt/lyrs=m@120&hl=en&x=%d&y=%d&z=%d&;s=Galileo
Sat:                                                                                                                                               
http://khm3.google.com/kh/v=36&hl=en&x=%d&y=%d&z=%d&s=Galileo

Generalization: The above 'Maps' URL isn't the current one anymore, also. Google changes the URL layout sometimes. To find out the current scheme open maps.google.com and view the page source. Search for http:// until you find sth similar to the above URL. This way I found

http://mt0.google.com/vt/lyrs=m@120&hl=en&x=%d&y=%d&z=%d&;s=Galileo

Now you could tweak your configuration unsing the above link (delete the 'amp;' tokens and replace every number with '%d'), for example with

gconftool-2 -s /apps/tangogps/repos \
"[OSM|http://tile.openstreetmap.org/%d/%d/%d.png|/media/mmcblk0p2/data/maps/OSM|\
0,Topo|maps-for-free|/media/mmcblk0p2/data/maps/maps4free|\
0,Aerial|openaerial|/media/mmcblk0p2/data/maps/openaerial|\
0,Opencyclemap|http://a.andy.sandbox.cloudmade.com/tiles/cycle/%d/%d/%d.png|/media/mmcblk0p2/data/maps/opencyclemap|\
0,Google Sat (testing only)|http://khm1.google.com/kh?v=34&hl=en&x=%d&s=&y=%d&z=%d|/media/mmcblk0p2/data/maps/googlesat|\
0,Google Maps (testing only)|http://mt0.google.com/vt/lyrs=m@120&hl=en&x=%d&y=%d&z=%d&;s=Galileo|/media/mmcblk0p2/data/maps/googlemaps|1]" \
--type list --list-type string

[edit] Updating to the newest version

As mentioned in the thread http://lists.openmoko.org/pipermail/community/2009-November/thread.html#57478 it is possible to update to the latest version by doing the following steps:

or more easy:

  • nano /etc/opkg/arch.conf

add 'arch armel 36' (without the quotes) to the bottom of the file and exit and save (CTRL-X, Y, Enter)

Either way, after that you may get an error

root@om-gta02 ~ $ tangogps
tangogps: error while loading shared libraries: libcurl-gnutls.so.4:
cannot open shared object file: No such file or directory

A symlink to libcurl.so.4 should help:

  • cd /usr/lib
  • ln -s libcurl.so.4 libcurl-gnutls.so.4
Personal tools

tangoGPS is one of the applications that runs on the Openmoko Phones. For a list of all applications, visit Applications

TangoGPS1.jpg TangoGPS

TangoGPS is a map application which can utilize Neo's built-in GPS to show your current location. It automatically downloads maps from http://openstreetmap.com and you can download map tiles for offline use too.


Homepage: http://www.tangogps.org
Package: tangogps
Tested on: Om 2008.8



Contents


tangoGPS is a map application which can utilize Neo's built-in GPS to show your current location.

TangoGPS1.jpg

Website: http://www.tangogps.org


Running tangoGPS

Om 2008.8

From the freerunner connected to the internet:

opkg update
opkg install gpsd
NOTE: I experienced hangups if gpsd was not installed.


opkg install http://www.tangogps.org/downloads/tangogps_0.9.5-r0_armv4t.opk

If opkg complains about not being able to acquire a lock, try:

pkill packagekit

To get gpsd working on the FreeRunner you have to change the configuration according to Gpsd#GPS_on_GTA02. Then start gpsd by:

/etc/init.d/gpsd start

If you get an error about no GPS device in /etc/default/gpsd execute:

echo "GPS_DEV=\"/dev/ttySAC1\"" > /etc/default/gpsd

Now you must power up the GPS-chip by opening the "Settings" application and setting the GPS entry to "on". Now you can run tangoGPS and wait until it get's a GPS fix. This can take up to a few minutes.

Debian

The latest version is available in Debian.

It depends on gpsd which conflicts with frameworkd in fso-frameworkd, but there is a package available that provides the gpsd interface to clients while using the services of the FSO frameworkd daemon, fso-gpsd. The install.sh script for the Debian distribution on the OpenMoko already installs it. To add tangogps run

  1. apt-get install tangogps

The gps device will be started automatically upon the invocation of tangogps or another gps application, e.g. like the one in Zhone. For the records, one can manually turn on the gps device using

  1. echo 1 >/sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0073/neo1973-pm-gps.0/pwron

The tangoGPS applications may appear as "GPS & Map" on various desktops.

Issues:

  • Both gpsd and the framework publish GPS data through dbus, though with different interfaces. This suggests a number of possible solutions.
    • gpsd or the framework could implement the other's interface (along with their own).
    • a translator could read one interface and emulate the other. This is what fso-gpsd does.
    • the framework could have an option to read data from gpsd.
    • ogpsd/gypsy could be extended to be backwards compatible with the majority of gps applications.

FSO Milestone 3 (OpenmokoFramework)

There are two various GPS interfaces -- (1) one provided with default gpsd and (2) the other provided by ogpsd (part of the frameworkd). tangoGPS requires the ad 1 and it obtains information from gps from the dbus interface provided by gpsd.

On FSO milestone 3, there is tangoGPS pre-installed as well as both gpsd and ogpsd (see /etc/frameworkd.conf, section ogpsd). As mentioned above, there also exists a fso-gpsd package, that converts from ad 2 to ad 1 (unfortunately fso-gpsd is not in default image and must be installed with opkg install fso-gpsd).

You cannot have both "providers" (ad 1 & ad 2) running, but you can have ad 2 (recommended for FSO) and "convertor" (fso-gpsd) providing the ad 1. To get usable tangoGPS on FreeRunner, one has to:

  1. check that /etc/frameworkd.conf, section ogpsd reads GPS data from the right device (/dev/ttySAC1)
  2. if changes were made to configuration, one should restart the frameworkd -- /etc/init.d/frameworkd stop && /etc/init.d/frameworkd start
  3. check that gpsd is not running -- /etc/init.d/gpsd stop
  4. check that fso-gpsd is installed and running -- opkg install fso-gpsd; fso-gpsd
  5. check that gps chip is online (echo 1 > /sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0073/neo1973-pm-gps.0/pwron) (Om 2009 newer kernels: echo 1 > /sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-regltr.7/neo1973-pm-gps.0/power_on)
  6. finally start up the tangoGPS and locate the gps signal; it should be up in a few minutes.

Note 1: handy application for testing the gps (and gps signal strength) is openmoko-agpsui, see general gps info at Gps

Note 2: You can automate the process -- (1) remove the startup script for gpsd (update-rc.d -f gpsd remove) and (2) create a simple startup scipt for fso-gpsd (you can use current script for gpsd as a skeleton)

Downloading Maps

pre-load for offline use

tangoGPS can bunch-download the map images so you don't need an internet connection while walking around. By default tangoGPS stores downloaded maps to /tmp/. This folder is lost every time you reboot the device. But you can use the "Config" tab within tangoGPS to change the "Cache Dir" location to , for example, /osm/ . So downloaded maps will be kept in the Neos flash, also after reboot. Note that the map files can take up large amounts of space, so you may want to store them on your sd card, e.g. in /media/card/osm or /media/mmcblk0p2/data/maps.

If you find that TangoGPS does not remember configuration changes that you make to it, be sure to run it from the touchscreen, and not an SSH session. TangoGPS uses gconf to store its settings, and cannot access gconf when run via SSH.

An alternative way to setup the configuration is through the command line. having /media/mmcblk0p2/data/maps as your data directory you could do the following:

gconftool-2 -s /apps/tangogps/repos \
"[OSM|http://tile.openstreetmap.org/%d/%d/%d.png|/data/maps/OSM|\
0,Topo|maps-for-free|/data/maps/maps4free|\
0,Aerial|openaerial|/data/maps/openaerial|\
0,Opencyclemap|http://a.andy.sandbox.cloudmade.com/tiles/cycle/%d/%d/%d.png|/data/maps/opencyclemap|\
0,Google Sat (testing only)|http://khm1.google.com/kh?v=34&hl=en&x=%d&s=&y=%d&z=%d|/data/maps/googlesat|1]" \
--type list --list-type string
Om2009 unstable 090805 Glenn:
(gconftool-2:1820): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed.
Error setting value: No D-BUS daemon running
root@om-gta02:~#

Once you have set the location to a non-volatile path, you can connect your Neo to the internet by USB or WiFi at home and start downloading the maps of your area. Tap the map screen and select "map download". Now on-the-road tangoGPS will be able to show you maps in different zoom levels even though you are not connected to the internet.

Downloading Maps via GPRS

I think tangoGPS may have started working after I followed the instructions to get GPRS working with GSM multiplexing here: Manually_using_GPRS#Option_1:_With_GSM_multiplexing_and_with_a_GUI

There are steps included in those instructions to improve GPS performance. The great thing is that once you get GPRS working, you can roam with TangoGPS running and have it download maps as needed over the GPRS connection!

Updating pre-downloaded maps

If you have many maps already downloaded, updateMaps.pl is a perl script to bring you up-to-date. It's made to work for OSM maps only, but can be adapted to work with any map dataset. See also: Yaouh!.

Using tangoGPS for OpenStreetMap.org

creating tracks

tangoGPS works fine to create track for Openstreetmap. However, it records and stores a track in its native format, use convert2gpx.pl (see also: tools)(you can also use convert2gpx.py) to convert the track to GPX (i.e to import into JOSM):

perl convert2gpx.pl 20080903_111508.log > 20080903_111508.gpx

tangoGPS logging format

<lat>,<lon>,<elevation>,<speed>,<course>,<hdop>,<datetime>

using OpenStreetBugs

see OSM wiki


Importing Tracks into tangoGPS

tangoGPS does not support the import of tracks directly. However the following xslt style sheet can be used to convert gpx tracks - e.g from routing software such as maps.cloudmade.com - to tangogps log files, which can then be imported

XSLT

At present this style sheet will only convert tracks which make use of the 'wpt' (waypoint) tag. Some software uses the 'trkpt' (trackpoint) tag. This will be incorporated into the stylesheet at some point. In the meantime, it can be used on the latter type of gpx file by changing 'wpt' to 'trkpt' on line 6.


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:g="http://www.topografix.com/GPX/1/1">
<xsl:output method="text" omit-xml-declaration="yes"/>
<xsl:template match="g:gpx" >
<xsl:for-each select="g:wpt">
<xsl:value-of select="@lat"/>,<xsl:value-of select="@lon"/>,11.8,1.1,346.0,1.4,2008-12-30T06:46:0<xsl:if test="position()!=last()"><xsl:text>1</xsl:text></xsl:if><xsl:if test="position()=last()"><xsl:text>2</xsl:text></xsl:if>Z
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

save this into a file called 'gpx2log.xslt', then run

$ xsltproc gpx2log.xslt input_file.gpx > output_file.log

move output_file.log to the tangogps traces directory, and use the 'Load...' button on the 'Track' tab to overlay it on the map

Note: this stylesheet was thrown together in a short time, and makes at least one shortcut - namely, the use of 'dummy' variables for various details, such as the altitude, date, etc. Feel free to improve this if required, although it has no bearing on the display of the track

python

This small python script will convert GPX tracks and routes to tangogps file format.


#!/usr/bin/env python

import sys, re
import xml.etree.cElementTree as ET

tree = ET.parse(sys.argv[1])
root = tree.getroot()
ns = re.match('{(.*)}', root.tag).group(1)

for trkpt in root.findall('.//{%s}trkpt' % ns) + root.findall('.//{%s}rtept' % ns):
    a = trkpt.attrib
    for key, default in (('ele', 555.55), ('speed', 1.0), ('hdop', 1.0), ('course', 0.0), ('time', '2009-05-16T09:35:58Z')):
        a[key] = trkpt.findtext('{%s}%s' % (ns, key)) or default
    print '%(lat)s,%(lon)s,%(ele)s,%(speed)s,%(hdop)s,%(time)s' % a


Testet with GPX files from bikemap.net, gpsies.com, bikeroutetoaster.com, www.vvs.de/radroutenplaner.

Usage:

$ ./gpx2tango.py MyTack.gpx > MyTrack.log

sqlite

You may help yourself by using this tool to import GPX trackpoints as a series of POIs directly into the sqlite database which tangoGPS uses to store POIs.

Using the TangoGPS logs

You can convert the logfiles from TangoGPS to other formats using gpsbabel and this style-file:

DESCRIPTION TangoGPS 0.92
EXTENSION log
DATATYPE TRACK

FIELD_DELIMITER COMMA
RECORD_DELIMITER NEWLINE

IFIELD LAT_DECIMAL,"","%f"
IFIELD LON_DECIMAL,"","%f"
IFIELD ALT_METERS,"","%f"
IFIELD PATH_SPEED,"","%f"
IFIELD PATH_COURSE,"","%f"
IFIELD GPS_HDOP,"","%f"
IFIELD ISO_TIME,"","%s" 

Save this as tangogps.style and you can use gpsbabel to for instance convert to google-earth files like this:

gpsbabel -i xcsv,style=tangogps.style -o kml -f file.log -F file.kml

Add POI from address

You can use gtkaddpoi for searching the destination address and add it as a POI.

Add POI from GeoRSS feed

If you would like to import GeoRSS feeds from Google maps or elsewhere as points of interest (POI), read this blog post. Hopefully TangoGPS upstream will include the script soon, but until then and if you aren't using Debian, download this script from the Debian bug tracker.

Converting tangogps's POI into gpx files(importable into JOSM)

You need to have the package python-sqlalchemy. On Debian/Ubuntu do:

sudo apt-get install python-sqlalchemy

Start this script in a directory where you have the poi.db file from TangoGPS (on the FR it is located in ~/.tangogps). Redirect the output into a .gpx file. For example:

scp root@neo:.tangogps/poi.db .
./poi2gpx > poi.gpx
 #!/usr/bin/env python
 #poi2osm convert a sqlite poi database comming from tangps to a file you can import in JOSM
 #Copyright (C) 2009  Denis 'GNUtoo' Carikli
 #
 #This program is free software: you can redistribute it and/or modify
 #it under the terms of the GNU General Public License as published by
 #the Free Software Foundation, either version 3 of the License, or
 #(at your option) any later version.
 #
 #This program is distributed in the hope that it will be useful,
 #but WITHOUT ANY WARRANTY; without even the implied warranty of
 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 #GNU General Public License for more details.
 #
 #You should have received a copy of the GNU General Public License
 #along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
 from sqlalchemy import *
 from sqlalchemy.orm import *
 
 class Poi(object):
 	def __init__(self,id,longitude,latitude,unk1,unk2,unk3,description,unk4,unk5,unk6,unk7,unk8,unk9,unk10,unk11):
 		self.id = id
 	def __repr__(self):
 		print repr(self.id)
 
 
 engine = create_engine('sqlite:///poi.db')
 session = create_session(bind=engine)
 metadata = MetaData('sqlite://')
 poi_table = Table("poi",metadata,
     Column('idmd5', Integer, primary_key=True),
     Column('lat', Integer),
     Column('lon', Integer),
     Column('visibility', Integer),
     Column('cat', Integer),
     Column('subcat', Integer),
     Column('keywords', String),
     Column('desc', String),
     Column('price_range',Integer),
     Column('extended_open', Integer),
     Column('creator', String),
     Column('bookmarked', String),
     Column('user_rating', String),
     Column('rating', String),
     Column('user_comment', String),
     )
 mapper(Poi, poi_table)
 
 print "<osm version=\"0.5\">"
 for poi in session.query(Poi).all():
 	print "  <node id=\""+ str(poi.idmd5) + "\" lat=\"" + str(poi.lat)  + "\" lon=\"" + str(poi.lon)  +  "\">"
 	print "    <tag k=\"name\" v=\""+ poi.keywords  +"\"/>"
 	print "  </node>"
 print "</osm>"
<pre>

== Using Google Maps with tangoGPS ==

Go to Config and create a new repository.

Set the url for '''street-maps''' to:
<pre>http://mt1.google.com/mt?&x=%d&y=%d&z=%d

for satellite-maps to:

http://khm.google.com/kh?&x=%d&y=%d&zoom=%d

for topographic-maps:

http://mt.google.com/mt?v=app.81&x=%d&y=%d&zoom=%d

Check the "Inverted Zoom" box. Press save Repository Configuration and you're ready to go.


Since TangoGPS 0.9.5 the "Inverted Zoom" box is no longer available because Google changed the addressing scheme; instead, select "xyz instead of zxy" and use the following URLs:

Maps:                                                                                                                                              
http://mt3.google.com/mt/v=w2.89&hl=en&x=%d&y=%d&z=%d&s=Galileo                                                                                    
                                                                                                                                                   
Sat:                                                                                                                                               
http://khm3.google.com/kh/v=36&hl=en&x=%d&y=%d&z=%d&s=Galileo

Generalization: The above 'Maps' URL isn't the current one anymore, also. Google changes the URL layout sometimes. To find out the current scheme open maps.google.com and view the page source. Search for http:// until you find sth similar to the above URL. This way I found

http://mt1.google.com/mt/v=w2.92&hl=en&x=3&y=5&z=4&s=Galile

Now you could tweak your configuration unsing the above link (delete the 'amp;' tokens and replace every number with '%d'), for example with

gconftool-2 -s /apps/tangogps/repos \
"[OSM|http://tile.openstreetmap.org/%d/%d/%d.png|/media/mmcblk0p2/data/maps/OSM|\
0,Topo|maps-for-free|/media/mmcblk0p2/data/maps/maps4free|\
0,Aerial|openaerial|/media/mmcblk0p2/data/maps/openaerial|\
0,Opencyclemap|http://a.andy.sandbox.cloudmade.com/tiles/cycle/%d/%d/%d.png|/media/mmcblk0p2/data/maps/opencyclemap|\
0,Google Sat (testing only)|http://khm1.google.com/kh?v=34&hl=en&x=%d&s=&y=%d&z=%d|/media/mmcblk0p2/data/maps/googlesat|\
0,Google Maps (testing only)|http://mt1.google.com/mt/v=w2.92&hl=en&x=%d&y=%d&z=%d&s=Galile|/media/mmcblk0p2/data/maps/googlemaps|1]" \
--type list --list-type string