Parsa Posted March 11, 2016 Share Posted March 11, 2016 I used to have a software program for Mac OS that would extract all the GPS or coordinate data from a text file and create a file with every set of coordinates on a line. I don't recall if it was comma or tab delimited, but either would be fine. I don't remember what app I was using. Does anyone know an application that will do this for me? Quote Link to comment
+Timpat Posted March 12, 2016 Share Posted March 12, 2016 Have a look at GPSBabel Quote Link to comment
Parsa Posted March 12, 2016 Author Share Posted March 12, 2016 Have a look at GPSBabel I have GPSBabel, but I wasn't aware it would extract coordinates from a general text file full of other text. Quote Link to comment
robertlipe Posted March 12, 2016 Share Posted March 12, 2016 With such a vague requirement, nothing is going to fulfill it. "Eighty three degrees and sixty four one hundredths north" isn't likely to parse in most software. If you have even some vague structure, GPSBabel may be able to help. Signed, GPSBabel Creator. Quote Link to comment
Parsa Posted March 12, 2016 Author Share Posted March 12, 2016 Let's say I had a document with entries like the following excerpt: ARIZONA Navajo National Monument (Kayenta) — 36.678227, -110.541034 Keet Seel (Kitsʼiil, Kiet Siel) — 36.760762, -110.496314 Betatakin (Bitátʼahkin) — 36.683988, -110.536184 Inscription House (Tsʼah Biiʼ Kin) — 36.670274, -110.819878 Canyon de Chelly National Monument (Chinle) — 36.153166, -109.539019 First Ruin — 36.144105, -109.501805 Junction Ruin — 36.145726, -109.489133 Ruin — 36.137805, -109.485667 White House Ruin — 36.133747, -109.470477 How would I enter this into GPSBabel? What format would I chose? Or would I have to do a lot of editing to make it comma delimited? Quote Link to comment
+Team CowboyPapa Posted March 13, 2016 Share Posted March 13, 2016 OK, I see an example of the input above. Now, how would the output that you desire appear? Quote Link to comment
+Team CowboyPapa Posted March 13, 2016 Share Posted March 13, 2016 (edited) Dupe Edited March 13, 2016 by Team CowboyPapa Quote Link to comment
+MartyBartfast Posted March 13, 2016 Share Posted March 13, 2016 I believe the Mac comes with the awk utility (if not then you can probably install it from somewhere), and if so I think this should do it for you from a command line, although I've never used a Mac so I'm making some assumptions, but it's worth a try: Assuming your list above is in a.txt, and you want to create a.csv which gpsbabel will accept awk -F\— '{printf "%s , %s \n",$2,$1}' a.txt > a.csv What this is doing is reading a.txt and splitting it at the — character, and printing the part on the right (the co-ord pair) first followed by a comma and then the part to the left (the name), to create a comma separated file in the format that gpsbabel likes. Note this won't work properly if the waypoint name has a — in it. Now use gpsbabel to convert a.csv into a.gpx to go on the GPS gpsbabel -i csv -f a.csv -o gpx -F a.gpx Note if the name of the waypoint has a comma in it then it will produce an incompatible .csv file as there will be too many commas. Catering for cases where the waypoint name has either a comma or a — in it would turn this into a "proper" program, rather than a 2 line solution so it would probably be simpler to tidy up the input file first to remove them if they exist [] Quote Link to comment
Parsa Posted March 13, 2016 Author Share Posted March 13, 2016 I believe the Mac comes with the awk utility ... <snip> Marty, that's interesting. I suppose I could do that in command line app Terminal. Quote Link to comment
+MartyBartfast Posted March 13, 2016 Share Posted March 13, 2016 I believe the Mac comes with the awk utility ... <snip> Marty, that's interesting. I suppose I could do that in command line app Terminal. I think you could, in fact you could reduce the whole thing to a single line: awk -F\— '{printf "%s , %s \n",$2,$1}' a.txt | gpsbabel -i csv -f- -o gpx -F a.gpx Quote Link to comment
Recommended Posts
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.