#!/usr/bin/perl

# simple conversion from Tokyo Coord to WGS
$T2W_LAT = +0.0032;
$T2W_LON = -0.0032;

while (<>) {
    my($lat, $lon) = /^   <trkpt lat="([\d.]+)" lon="([\d.]+)">/ or next;
    $lat -= $T2W_LAT;
    $lon -= $T2W_LON;
    $_ = <>;
    my($elev) = /^    <ele>([-\d.]+)<\/ele>/ or die "No elevation";
    $elev = int($elev + .5);
    $_ = <>;
    my($h, $ms) = /^    <time>[\d-]+T(\d\d):(\d\d:\d\d)Z<\/time>/ or
	die "No time";
    $h = ($h + 9) % 24;	# UT to Japan time
    print "$lat\t$lon\t$elev\t$h:$ms\n";
}
