forked from GPSBabel/gpsbabel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.xmapwpt
66 lines (45 loc) · 2.03 KB
/
README.xmapwpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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