Page 1 of 1

Too tough for this new user... Any suggestions?

Posted: Mon Mar 03, 2008 5:15 pm
by rkerian
Before I have to paying someone to get me out of a jam, I was told that perhaps a TextPad power-user may be able to help me out....

I have a GIS file (a small portion is shown below) that I need to get into standard X Y Z format... ("LAT" "LONG" "Zvalue"). Most of the data in the INPUT file is not needed. All I need to just to extract each "LAT" & "LONG" value, and the "Zvalue" found on the line following the LAT-LONG line.

For example the Output for the below Input would be:
2917.079139 09624.825405 47836.218
2917.079146 09624.825370 47836.779


INPUT FILE:
21 $GPGGA,165121.00,2917.079139,N,09624.825405,W,2,09,0.9,34.49,M,-22.97,M,8.6,0100*4A 17:38:29.01 01/13/29
0 0.000 47836.218 17:38:29.-99 01/13/29 0
0 0.000 47836.063 17:38:29.-199 01/13/29 0
0 0.000 47836.114 17:38:29.-299 01/13/29 0
0 0.000 47836.301 17:38:29.-399 01/13/29 0
0 0.000 47836.222 17:38:29.-499 01/13/29 0
0 0.000 47835.998 17:38:29.-599 01/13/29 0
0 0.000 47836.110 17:38:29.-699 01/13/29 0
0 0.000 47836.027 17:38:29.-799 01/13/29 0
0 0.000 47836.525 17:38:29.-899 01/13/29 0
21 $GPGSA,A,3,01,05,18,14,15,11,22,25,30,,,,1.7,0.9,1.5*31 17:38:28.01 01/13/29
0 0.000 47836.826 17:38:28.01 01/13/29 0
21 $GPGGA,165120.00,2917.079146,N,09624.825370,W,2,09,0.9,34.46,M,-22.97,M,7.6,0100*46 17:38:28.01 01/13/29
0 0.000 47836.779 17:38:28.-99 01/13/29 0
0 0.000 47836.418 17:38:28.-199 01/13/29 0
0 0.000 47836.157 17:38:28.-299 01/13/29 0
0 0.000 47836.128 17:38:28.-399 01/13/29 0
0 0.000 47835.828 17:38:28.-499 01/13/29 0
0 0.000 47835.611 17:38:28.-599 01/13/29 0
0 0.000 47835.284 17:38:28.-699 01/13/29 0
0 0.000 47835.378 17:38:28.-799 01/13/29 0
0 0.000 47835.185 17:38:28.-899 01/13/29 0
21 $GPGSA,A,3,01,05,18,14,15,11,22,25,30,,,,1.7,0.9,1.5*31 17:38:27.01 01/13/29
0 0.000 47826.648 17:38:27.01 01/13/29 0

Any help would be appreciated!

Rob Kerian

Posted: Mon Mar 03, 2008 7:43 pm
by MudGuard
I have a two-step solution.

First, do a replacement (Posix Syntax enabled), replace

Code: Select all

.*GPGGA,[^,]+,([^,]+,).,([^,]+,).*\n0 [0-9.]+([^,]+).*
by

Code: Select all

\1\2\3
Second, replace

Code: Select all

(0|21) .*\n
by nothing

Posted: Tue Mar 04, 2008 12:28 am
by Bob Hansen
Here is another solution:

Combine both lines to be used:
1. Search for ^(21.{29},N,.*)\n(.*)\n
Replace with \1~\2\n

2. Delete lines not to be used
Find ^.{80,} and Mark All
Invert the Tags (Search/Invert All Bookmarks)
Delete all lines not tagged (Edit/Delete/Bookmarked lines_

3. Remove unwanted characters
Search for:
^21.{18}(.{11}),N,(.{12}).*~.{8}(.{9}).*
Replace with:
\1,\2,\3


This can also be automated and saved as a macro for repeated use.

Example above is untested, don't have access to TextPad right now.