[Gpsbabel-code] trivial patch for osm.c
Brought to you by:
robertl
From: Sven G. <li...@fu...> - 2008-08-14 21:26:24
|
Hello, would you please apply the following trivial patch for osm.c? Using this patch it is possible to change the created_by tag in osm Output like this: gpsbabel -i INTYPE -f INFILE -o osm,created_by=foobar -O out.osm as well as omit it altogether using an empty string like this: gpsbabel -i INTYPE -f INFILE -o osm,created_by= -O out.osm The reason for the patch is that osm output files tend to get very big is this tag is not omitted. Regards Sven --- osm.c.orig 2008-08-14 22:25:06.549645351 +0200 +++ osm.c 2008-08-14 22:40:05.337795184 +0200 @@ -24,12 +24,13 @@ #include "avltree.h" #include "xmlgeneric.h" -static char *opt_tag, *opt_tagnd; +static char *opt_tag, *opt_tagnd, *created_by; static arglist_t osm_args[] = { { "tag", &opt_tag, "Write additional way tag key/value pairs", NULL, ARGTYPE_STRING, ARG_NOMINMAX }, { "tagnd", &opt_tagnd, "Write additional node tag key/value pairs", NULL, ARGTYPE_STRING, ARG_NOMINMAX }, + { "created_by", &created_by, "Use this value as a custom created_by value","GPSBabel", ARGTYPE_STRING, ARG_NOMINMAX }, ARG_TERMINATOR }; @@ -785,11 +786,14 @@ } gbfprintf(fout, ">\n"); - gbfprintf(fout, " <tag k='created_by' v='GPSBabel"); - if (gpsbabel_time != 0) - gbfprintf(fout, "-%s", gpsbabel_version); - gbfprintf(fout, "'/>\n"); - + if (strlen(created_by) !=0) { + gbfprintf(fout, " <tag k='created_by' v='%s",created_by); + if (gpsbabel_time != 0) + if (strcmp("GPSBabel",created_by)==0) + gbfprintf(fout, "-%s", gpsbabel_version); + gbfprintf(fout, "'/>\n"); + } + osm_write_tag("name", wpt->shortname); osm_write_tag("note", (wpt->notes) ? wpt->notes : wpt->description); if (wpt->icon_descr) @@ -837,10 +841,13 @@ { if (skip_rte) return; - gbfprintf(fout, " <tag k='created_by' v='GPSBabel"); - if (gpsbabel_time != 0) - gbfprintf(fout, "-%s", gpsbabel_version); - gbfprintf(fout, "'/>\n"); + if (strlen(created_by) !=0) { + gbfprintf(fout, " <tag k='created_by' v='%s",created_by); + if (gpsbabel_time != 0) + if (strcmp("GPSBabel",created_by)==0) + gbfprintf(fout, "-%s", gpsbabel_version); + gbfprintf(fout, "'/>\n"); + } osm_write_tag("name", rte->rte_name); osm_write_tag("note", rte->rte_desc); -- "If you don't make lower-resolution mapping data publicly available, there will be people with their cars and GPS devices, driving around with their laptops" (Tim Berners-Lee) /me is giggls@ircnet, http://sven.gegg.us/ on the Web |