Hello,
My regex powers are mediocre on good days. I've manged to accomplish what I need to do one step at a time, but the repeated chore makes me wonder if the process might be streamlined. I'm not asking for somebody to do the work for me, but rather I'm hoping for guidance on the best approach to consolidate my one-step-at-a-time formula - see my steps noted below. The gist of it is to take the portion of a Global Mapper Pixels to Points HTML report showing final adjusted camera locations (table) and convert it into a tab delimited format.
Thanks very much for any thoughts.
Kelly
3:33 AM Thursday, August 18, 2022 (VKB)
Final Camera Locations HTML Wrangle for TextPad & RegEx
Beginning with P2P's Pixels to Points Processing Report.htm open in browser
Ctrl+u to show html source
Locate table beginning with
<tbody><tr>
<th>Filename</th>
<th>Latitude</th>
<th>Longitude</th>
<th>Elevation</th>
<th>Roll</th>
<th>Pitch</th>
<th>Yaw</th>
</tr>
Then copy everything beneath it until the end of the table
</tr>
</tbody></table><br>
Paste into new TextPad document and begin cleanup
Replace with nothing
\t
<td align="left">
<td align="center">
<td align="right">
°
m
N
W
Replace ^69 with -69 (or whatever your longitude)
Replace </td>\n with \t
Replace <tr>\n with nothing
Replace </tr>\n with \n
Doing this last bit will allow loading text file into Global Mapper (Y/Northing first)
Column cut DJI_0000 and paste at end of last tab
Replace ^\t with nothing
Insert column header row
Latitude Longitude Elevation Roll Pitch Yaw Filename
When you're done, should look smoething like
Latitude Longitude Elevation Roll Pitch Yaw Filename
44.9521476511 -69.1742673904 36.144 0.000 -86.960 175.866 DJI_0090
44.9520710267 -69.1742679789 36.810 0.000 -87.283 177.629 DJI_0091
44.9520062489 -69.1742633697 36.983 0.000 -87.593 177.971 DJI_0092
44.9519419705 -69.1742591335 36.745 0.000 -87.938 178.182 DJI_0093
44.9518775907 -69.1742574740 36.776 0.000 -88.267 177.975 DJI_0094
It would be useful to see the actual HTML code. Could you post the code for the table containing the five rows in your example? I'd suggest using the code tags for just the HTML code, not for explanatory text.
Save macro and use it again as often you want for other files
As per "replace with" you can figure out that the "find" regex just captures all 7 columns at once, avoiding spaces and the opening tag. Record it once as macro, then just playback the macro when needed again.
Oh my gosh! Thank you AmigoJack for doing this work, and by way of this instructive example introducing me to \s together with F8 and making a macro!! I will need to study/ dissect this with the TextPad Help section open to Replacement Format Strings.
Thanks again and I'll let you know how this turns out! I very much appreciate the help! - Kelly
AmigoJack, I did the other stuff which included cleaning up the html row codes, and entering the header stuff while recording the macro, and in the order of operations as you outlined. Works great! Thanks again for all of your greatly appreciated help!
If you want to dive into regular expressions (a topic that TextPad's help can't fully cover) then nowadays https://www.regular-expressions.info/quickstart.html is very worth to be read from top to bottom, either to always look it up again when you need it, or to use as a base to then hit chosen "Tutorial" pages, selecting from dozens of specific topics those you feel confident enough to grow your understanding of it even more.
Thank you AmigoJack for the instructive next step. I will try that site again but now in retirement, with more earnestness and time than I had 9 years ago. After finding Jan Goyvaets's site in 2013, I bought the book https://www.regular-expressions.info/hipowls.html. I never made it past the first 2 chapters. For now, I'll just try and apply myself to what you've outlined and keep the book by Jeffrey Fiedl on the shelf