Sophie

Sophie

distrib > * > cooker > x86_64 > by-pkgid > a2c4aa8f4c9dd2417cea287bd89aa647 > files > 9

gpsbabel-1.4.3-1.x86_64.rpm


NOTE: THIS README PERTAINS TO THE "XMAPWPT" FORMAT, NOT THE XMAP/TOPO USA
      4.0 CONDUIT "XMAP" FORMAT.


Delorme XMap Handheld .WPT for PocketPC is a bit of a kludge.  This 
document covers XMap Handheld Street Atlas USA edition.

XMap on the PocketPC stores it's waypoints in individual .wpt files.
For example, waypoints generated by XMap on the PocketPC are stored
by default in the "My Documents" folder using the sequential names
"XMap1.wpt", "XMap2.wpt", ad nauseum.  Needless to say, not very
efficient.

As writing multiple waypoint files is outside of the scope of gpsbabel,
gpsbabel chooses to write one big file, one waypoint per line.  
Extracting lines from this file is left as an exercise for the end user.  
A simple perl script to handle this conversion is included at the end 
of this README.

It should also be noted that READING multiple files is indeed possible,
but if you have more than a few points, it can be a task.  For example:

gpsbabel -i xmapwpt -f Xmap1.wpt -f Xmap2.wpt -o mapsend -F mapsend.wpt

will read the two Xmap .wpt files and write one mapsend file.  This
is fine for a small handful of points, but could be quite cumbersome
for folks like me who have 100+ waypoints loaded into XMap.  For *nix
folks, something as simple as:

cat *.wpt > /tmp/foo.wpt
gpsbabel -i xmapwpt -f foo.wpt -o mapsend -F mapsend.wpt 

will do the trick just fine.  


############ BEGIN SCRIPT 
#!/full/path/to/perl
$INPUTFILE = @ARGV[0];
$TARGETDIR = @ARGV[1];
$FILENAME  = @ARGV[2];

if (! $FILENAME) {
    print "Usage: xmap_split.pl INPUT_FILE OUTPUT_DIRECTORY FILENAME_BASE\n";
    print " (i.e. xmapl_split.pl points.wpt /tmp/points GPSB)\n";
    print " (created GPSB0001-GPSBXXXX in /tmp/points/ from points.wpt)\n";
    exit;
}

open (INFILE, $INPUTFILE) || die "Cannot open $INPUTFILE for read!\n";

while (<INFILE>) {
    $lc++;
    $filename = sprintf("%s/Gpsb%04d.wpt", $TARGETDIR, $lc);

    open (OUTFILE, ">$filename") || die "Cannot open $filename for write!\n";

    print OUTFILE $_;

    close(OUTFILE);
}

exit;

########### END SCRIPT