Anti-Whining: Happy Moko Moments

Timo Juhani Lindfors timo.lindfors at iki.fi
Sat Jul 18 11:13:40 CEST 2009


Warren Baird <wjbaird at alumni.uwaterloo.ca> writes:
> What are your successes with the Freerunner?

I love how easy it is to do quick application development.

For example, last week I was in Norway and suddenly figured out that
all the hiking maps have UTM coordinates which I know nothing
about. The following was done in a car with the xvkbd virtual keyboard
on debian. (A real physical keyboard would probably have saved some
time).

1) 15 minutes to google what UTM is with the elinks browser over GPRS.

2) 15 minutes to figure out that debian has a package called 'proj'
   (Cartographic projection filter and library) that I can use to do
   the conversion. I installed this package first on my server over
   SSH so that I can test it before downloading it to my phone.

3) 15 minutes to read the man page of proj and write a simple script
   that converts latitude/longtitude to UTM x/y coordinates:

$ cat ~/bin/utm
#/bin/sh
lat="$1" # 60
lon="$2"
lon_0="$3"
echo $lat $lon |proj +proj=utm -r +ellps=WGS84 +lon_0=$lon_0

4) 10 minutes to read the man page again to really understand what an
   earth is going on and compare the results against a paper map :-)

5) 10 minutes to write a helper that fetches current position from GPS
   and shows it in UTM coordinates:

$ cat ~/bin/utm-show
#!/usr/bin/perl

my $ret = `gps-get-position`;
#my $ret = "70.175485000 24.903566833";
chomp($ret);
my ($lat, $lon) = split(/[ \t]+/, $ret);
$ret = `utm $lat $lon 29`;
chomp($ret);
my ($x, $y) = split(/[ \t]+/, $ret);
printf("%02.1f\n%02.1f\n",
       ($x % 100000) / 1000.0,
       ($y % 100000) / 1000.0);

6) 10 minutes to write a very simple helper that shows the UTM
   coordinates with xmessage in fullscreen and has two buttons, one to
   get new position from GPS and one to quit.

$ cat ~/bin/xutm-show
#!/bin/sh
while true; do
    xmessage -fn '-*-clean-*-*-*-*-*-1600-*-*-*-*-*-*' -geometry 480x640+0+0 -buttons r,q "`utm-show`"
    ret="$?"
    if [ "$ret" = "101" ]; then
        continue
    fi
    if [ "$ret" = "102" ]; then
        exit
    fi
done






More information about the community mailing list