Navit and Geocaching

Monday 16.3.2015 22:45:23, Jakuje

Starting navigation from external application

When I started looking for cooperation between Navit and other app I started searching Navit sources and I found that there is file command.txt, that is read by navit and which runs one-time command after startup. This seemed really promissing, but there was no documentation and even developers didn't answer me.

After days of despair I started going through thir wiki and I finally found how to create waypoints, pass them to Navit and show them as POI's. And it wasn't even so hard after translating from German post.

Geocaches as POI

This was not the way I wanted for the first time, but it solves the problem also. So here is fast how-to (I expect you have GPX downloaded from geocaching.com):

Convert your downloaded GPX into file readable by Navit

There are two possibilities. One for commandline and second if you like more clicking and java applications:

Terminal option:

  1. Download XSL File from github
  2. convert your GPX from command-line:
    xsltproc gpx2navit.xsl 9897043.gpx > 9897043_nav.txt

Java option:

  1. Download gpx2navit_txt and run downloaded java application
  2. Select your GPX in the first field and click Start. This will convert your GPX file into *_nav.txt file in the same directory.

Copy resulting file into your phone

  • Copy resulting file to your phone:
    cat 9897043_nav.txt | novaterm put file:///media/internal/appdata/org.webosinternals.navit/maps/cache.txt

Configure Navit

  1. Add this file into your mapset, for example in
    /media/internal/appdata/org.webosinternals.navit/maps/mapset.xml (default location in webOS)
    add into mapset tag line
    <map type="textfile" enabled="yes" active="yes" data="/media/internal/appdata/org.webosinternals.navit/maps/cache.txt" />
  2. Copy geocache icon to your phone:
    cat cache.png | novaterm put file:///media/cryptofs/apps/usr/palm/applications/org.webosinternals.navit/share/navit/xpm/poi/cache.png
  3. Set icon and visibility to our POIs in
    /media/internal/appdata/org.webosinternals.navit/layouts/Car.xml.poi
    by adding to the end
    <layername="Geocaches"><itemgra item_types="poi_attraction" order="13-"><icon src="$NAVIT_SHAREDIR/xpm/poi/cache.png"/></itemgra></layer>

Final notes

  • In the code, "order" means zoom levels for which is waypoint visible (i prefer to have caches visible from distance),
  • NAVIT_SHAREDIR is directory with all the other icons so I put mine also there
  • icon cache.png is here:
  • All together can look like this (sorry, I'm not currently on the road, so it is screen from home)

 

I was affraid of putting large GPX into the map, but even 1000 caches are "packed" into 150kB and in comparison with all the large map, it is really small overhead and it works fast and well as a charm.

I'm using defaulf files/directory organization from webOS, but for other platforms it is also possible to have such a setup (you will probably have to adjust paths).

Diskuse:

:
:
:

 
    

Podbarvená pole označená hvězdičkou jsou povinná!