Re: [Gpsbabel-code] maggeo output addition
Brought to you by:
robertl
From: Robert L. <rob...@us...> - 2007-05-13 22:19:52
|
> gpsbabel -i geo -f geocaching.loc -o maggeo -F geocaching.gs The root of this problem is that your input format is less descriptive than the output format. Pocket queries from Groundspeak contain the data you're looking for in a ready to parse format that we already know how to read very well. > which is a bit hard to tell one from another. I've modified the maggeo.c file to use the first 20 chars from the description, also excluding the ' by ', which produces output like this: If you're going to get ambitious with this, don't break the maggeo writer; smarten up the geo reader. Even though .loc doesn't contain things like diff and terrain in a very nice format, you can dumpster dive in the strings and extract placer, diff/terr, and a few other useful nuggets. > 181: cname=xmalloc(32); /* alloc some memory for cname */ > 182: strncpy(cname,waypointp->description,32); /* take 32 chars (max) to make sure we don't get part of ' by '*/ > 183: cname_by_pos=strstr(cname," by "); /* find if ' by ' exists (who placed it) */ > 184: if(cname_by_pos != NULL) *cname_by_pos=0; /* if exists then chop before */ > 185: cname[20]=0; /* in any case, take max 20 chars for final */ Even if we wanted this in the writer (and we don't) you need to look for the last occurrence " by " or elase a cache named In a van, down by the river by JoGPS will get the placer name wrong. In general, modifying outputs to try to compensate for bad input in GPSBabel is a losing bid. You'll find much more joy (and more support by those that can apply the patch) if you push this kind of logic into geo.c. Populate the gc_data member of waypoint in the reader there and it'll Just Work for most output types. RJL |