HowToUseGPSFrameworkInOS2007

HowTo use GPS framework in OS2007

OS2007 release contains various GPS APIs that allow multiple applications to simultaneously use positioning data from GPS device.

The framework consists of following parts: * GPS daemon (gpsd) is used to connect to bluetooth GPS devices through rfcomm serial port interface * libgps is used get the positioning data from gpsd * libgpsmgr is used to start/stop gpsd * libgpsbt is used to find available bluetooth devices

Note that gpsd is only running when there is an application that wishes to get position data from GPS device. The libgpsmgr makes sure that even if there is multiple programs running that need location information, only one instance of gpsd is running. The OS2007 release does not contain any program by default that uses the framework but the geotagging tool shows what can be done with various APIs.

Geotagging example program

Geotagging is method where GPS data is attached to image's exif data. This means that if you take pictures using your digital camera and if your cameras clock is set correctly, it is possible to add GPS position information to your pictures.

This geotagging application consists of two parts

  • GPS data collector that is running in your N800
  • post-processor which is running in your PC

GPS data collector consists of two Debian packages

  • gps-saver which uses services provided by GPS framework (mainly libgpsbt and libgps)
  • gps-starter which starts/stops collector process directly from hildon menu

The data collector packages can be found from garage at https://garage.maemo.org/projects/gps-saver/ and https://garage.maemo.org/projects/gps-starter/ The post-processor (gtag) can be found at https://garage.maemo.org/projects/gtag/

Workflow

  • First install the gps-saver and gps-starter to N800.
  • Pair your BT GPS device with N800
  • Start the gps-saver process from Extras -> Activate GPS saver
  • The GPS data is by default saved to SD card in /media/mmc1, the location can be changed by editing /etc/default/gps_saver file. The positioning data is saved to compressed file with one file / gps-saver invocation. The file name looks like gps.DATE.X.log.gz, the DATE is the starting time of the log and X is incremented for each run the of the collector if they are started in the same minute
  • When you have wondered around and have took some pictures with your fancy digital camera, you can then attach the location data to your images in post-processing phase
  • Transfer the positioning files from SD card to you PC where you have installed the gtag program and where you have access to your images (the post-processing scripts are not meant to be run in N800)

Post-processing in your PC

In post-processing phase you attach position information to your image files.

Do this: * install gtag to your Debian based linux PC, use the source if you want to install it yourselves or if you are not using debian * transfer GPS log file, that was collected earlier, to your PC * execute

$ gtag -f gps.200609201943.1.log.gz -o tagged *.jpg
  • the -o parameter tells the directory where all geotagged images are placed
  • the gtag program needs sh and perl interpreter, and these perl packages (automatically installed in Debian system)

    • libmath-round-perl
    • libdate-manip-perl
    • libimage-exiftool-perl
  • gtag program accepts following parameters

-f <name of the gzipped file containing GPS position data>
-o <output directory>, modified files are saved here
-l <log file name>

Following extra parameters can be given also (they are passed directly to gps2photo script)
--credit <your credit text>
--city <your city name>
--state <your state name>
--country <your country name>
--copyright <your copyright info>
--source <your source link, like 
--keywords <keywords, like waterfall,mountains,lakes etc>
--kml <your kml file name for google earth>
--kmlprefix <prefix to be added to image link in kml file>, like 
--ignalt, ignore altitude and do not put it into image exif
  • if --kml parameter is given, then the gtag produces a file for Google Earth, see MoinMoinWiki Macro: <http://earth.google.com/kml/whatiskml.html> for more information.

  • note that the altitude from the GPS device seems most of the time to be total garbage so you might want to use --ignalt parameter so that it is not put to image exif data

  • use following command to verify that coordinates are placed correctly to image file

$ cat geotaggedimage.jpg | exiftool -
  • The following link shows what can be generated using gtag program MoinMoinWiki Macro: <http://maps.google.com/maps?f=q&hl=en&q=http://www.kolumbus.fi/jukkarissanen/lansivayla/lansivayla-east-west.kml&ie=UTF8&z=14&ll=60.156158,24.656067&spn=0.036092,0.080853&t=k&om=1&iwloc=E> example route using Google Maps

Usage in 770

It is possible to use the geotagger also in 770 with some restrictions. Because the UI for BT pairing of GPS devices is not found in 770, the pairing must be initiated manually ("gps_saver -p" command can be used for this), also the osso-gpsd, libgpsmgr and libgpsbt packages are missing in 770 so you would need to install them manually. I have not really tested this setup.

Example:

# gps_saver -p 00:12:76:FD:45:52

would initiate the pairing to that BT GPS device.

Todo

  • Graphical tool to start/stop/monitor the gps-saver program, this would replace the simple gps-starter menu, support for this kind of handler is already in place in gps_saver.c