Jump to content

Program to get just GC# from a .gpx file


jholly

Recommended Posts

Posted

I am looking for a program to generate a list of GC codes that are in a .gpx file. Yes I know GSAK can do it. But GSAK is not an option. Think simple and cheap, like in zero. A File->input, File->output is what I am looking for. I played with GPSBabel GUI a bit but did not seem to find the combination, will that work?

Posted

You can also download Notepad++ and use regular expression search and replace if you don't mind doing it semi-manually (a few clicks and some typing and you're done).

 

For the command line dfx suggested, you can find a Windows command line version of grep. There's also a Windows command line version of cut. You can replace the "cat | grep" with "grep '<name>GC' xxx.gpx" (or replace cat with type) - DOS piping wasn't efficient, don't know if Windows command line improved it. I don't have my usual working environment with me right now so I can't test it.

Posted
For the command line dfx suggested, you can find a Windows command line version of grep. There's also a Windows command line version of cut. You can replace the "cat | grep" with "grep '<name>GC' xxx.gpx" (or replace cat with type) - DOS piping wasn't efficient, don't know if Windows command line improved it. I don't have my usual working environment with me right now so I can't test it.

or you can just use an old favorite of mine, cygwin :)

Posted
or you can just use an old favorite of mine, cygwin :)

Good if jholly (what's that avatar anyway? Cthulhu in a Santa hat?) wants to duplicate a Unix environment in Windows. For just one task seems to be overkill though ;)

 

Oh, I forgot to mention "unix2dos" which may be necessary to convert between Unix style line terminators and Microsoft style.

Posted

Good if jholly (what's that avatar anyway? Cthulhu in a Santa hat?) wants to duplicate a Unix environment in Windows. For just one task seems to be overkill though :)

 

The Christmas avatar is Dr. Zoidberg from Futurama. Personally I have no problem with the Unix/Linux environment tools. I was looking for something that did not take a lot of computer smarts and could achieve group caching without overtones of TOU violations.

Posted

Import it into Excel and strip out the extra columns . . .

 

I had thought of that, but my Excel 2000 does not grok xml files. Perhaps newer versions do.

Posted

It seems that both GPSBabel and extra POI editor do put out csv files. But the files contain the cache NAME, not the GC code of the cache. I have not been able to figure out how to get the GC code into a column.

Posted

If your input file is input.gpx and your output file is output.csv use:

 

gpsbabel -i gpx -f input.gpx -o unicsv -F output.csv

 

From what I'm seeing, the 4th column will be the GCID.

Posted

It seems that both GPSBabel and extra POI editor do put out csv files. But the files contain the cache NAME, not the GC code of the cache. I have not been able to figure out how to get the GC code into a column.

Did you miss post #5 above......

Posted

I am looking for a program to generate a list of GC codes that are in a .gpx file. Yes I know GSAK can do it. But GSAK is not an option. Think simple and cheap, like in zero. A File->input, File->output is what I am looking for. I played with GPSBabel GUI a bit but did not seem to find the combination, will that work?

 

OK, here is a program that meets all your needs and requirements.

 

GSAK, it is free if you don't mind the nag screen it trying to reinvent and you can quit trying to reinvent the wheel. It also has macros, an ability built in to filter on users as well as many workarounds listed in the forums to help with group caching.

 

For me, time is money and this program is cheap at 3 times it's current price. So I have registered it as I am pretty sure Clyde feels the same way however he still offers it free ($0)with commercials.

Posted

I am looking for a program to generate a list of GC codes that are in a .gpx file. Yes I know GSAK can do it. But GSAK is not an option. Think simple and cheap, like in zero. A File->input, File->output is what I am looking for. I played with GPSBabel GUI a bit but did not seem to find the combination, will that work?

 

OK, here is a program that meets all your needs and requirements.

 

GSAK, it is free if you don't mind the nag screen it trying to reinvent and you can quit trying to reinvent the wheel. It also has macros, an ability built in to filter on users as well as many workarounds listed in the forums to help with group caching.

 

For me, time is money and this program is cheap at 3 times it's current price. So I have registered it as I am pretty sure Clyde feels the same way however he still offers it free ($0)with commercials.

Excellent suggestion, and an excellent program and the first one I thought of. But as stated in the OP, that is not an option.

Posted

If your input file is input.gpx and your output file is output.csv use:

 

gpsbabel -i gpx -f input.gpx -o unicsv -F output.csv

 

From what I'm seeing, the 4th column will be the GCID.

got it.

Posted

It seems that both GPSBabel and extra POI editor do put out csv files. But the files contain the cache NAME, not the GC code of the cache. I have not been able to figure out how to get the GC code into a column.

 

That's not what happened when I exported a file to CSV right before I posted. (I tested to see if it would work.)

 

This is what I got.

 

Longitude Latitude POI Name Address

-76.292683 36.906767 GC23R34

-76.285267 36.898133 GCJHG7

-76.282683 36.9024 GCV22Q

Posted

I am looking for a program to generate a list of GC codes that are in a .gpx file. Yes I know GSAK can do it. But GSAK is not an option. Think simple and cheap, like in zero. A File->input, File->output is what I am looking for. I played with GPSBabel GUI a bit but did not seem to find the combination, will that work?

 

OK, here is a program that meets all your needs and requirements.

 

GSAK, it is free if you don't mind the nag screen it trying to reinvent and you can quit trying to reinvent the wheel. It also has macros, an ability built in to filter on users as well as many workarounds listed in the forums to help with group caching.

 

For me, time is money and this program is cheap at 3 times it's current price. So I have registered it as I am pretty sure Clyde feels the same way however he still offers it free ($0)with commercials.

Excellent suggestion, and an excellent program and the first one I thought of. But as stated in the OP, that is not an option.

 

However the only indication you gave as to why was cheap.

Posted

I am looking for a program to generate a list of GC codes that are in a .gpx file. Yes I know GSAK can do it. But GSAK is not an option. Think simple and cheap, like in zero. A File->input, File->output is what I am looking for. I played with GPSBabel GUI a bit but did not seem to find the combination, will that work?

EasyGPS will do what you want.

Posted
Yes I know GSAK can do it. But GSAK is not an option.
That worked well. :laughing: I know there are ways to put people in a kill file so you don't have to read their posts. I wish there was a way to filter out posts where people suggest using GSAK. :sad:
Posted

While the question has been answered, as a 20+ year UNIX guy, I can't let this one go without a lesson in text processing. :-)

 

cat xxx.gpx | grep '<name>GC' | cut -d\> -f 2 | cut -d\< -f1

 

that good enough? :)

 

Two processes is better than four. Take advantage of knowing the traits of the text:

grep "<name>"xxx.gpx | tr -d " /<>[:lower:]"

 

Better still to use only one process:

sed -n "s#.*<name>\(.*\)</name>#\\1#p" xxx

 

Treating GPX/XML as plain text is kind of tacky, but if there's not great expressiveness in the input (i.e. you're parsing PQs from Groundspeak and not arbitrary GPX) that's OK.

Posted

While the question has been answered, as a 20+ year UNIX guy, I can't let this one go without a lesson in text processing. :-)

 

cat xxx.gpx | grep '<name>GC' | cut -d\> -f 2 | cut -d\< -f1

 

that good enough? :anibad:

 

Two processes is better than four. Take advantage of knowing the traits of the text:

grep "<name>"xxx.gpx | tr -d " /<>[:lower:]"

 

Better still to use only one process:

sed -n "s#.*<name>\(.*\)</name>#\\1#p" xxx

 

Treating GPX/XML as plain text is kind of tacky, but if there's not great expressiveness in the input (i.e. you're parsing PQs from Groundspeak and not arbitrary GPX) that's OK.

OK, I admit it. As a perl zealot, I am more annoying than GSAK users. At least I don't use emacs. :mad:

 

perl -e 'local $/, $_=<>; print join("\n", /name>\s*?(\S*?)\s*?<\/name/mg);' xxx.gpx

 

Works if the <name> tag is split across lines, I think.

Posted

Application done. If anybody else wants it, let me know. I can put it up on the website. FWIW, it uses the Xerces C++ XML library and it is very fast. Less than a second per 500-cache file on my machine.

Posted

Application done. If anybody else wants it, let me know. I can put it up on the website. FWIW, it uses the Xerces C++ XML library and it is very fast. Less than a second per 500-cache file on my machine.

 

Cool...thanks!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...