Friday, March 31, 2023

Passover Prep 2023 | New Questions, New Resources

It's Seder prep time, which means I've been re-reading the Haggdah. While I don't have a whole lot new answers, I've been lucky enough to find some new questions.

1. The Ha Lach Ma is a already a curious way to start the seder. For example: why call for people to join you at a meal once the meal has already begun? But this year I've got a new question: we are inviting all "who are hungry" to not just 'eat', but to eat "the bread of affiliation." What kind of offer is that?

2. The story of the Five Rabbis emphasizes that even the very wise should study Passover in detail. That's sensible. But if that's the purpose, why not use the story of the Rabbis recorded in Tosefta Pesachim 10:12 to show this? Why seemingly invent a similar story with a different cast of characters to show the same thing?

3. We've often wondered why the wise son can get away with using the phrase 'to you,' but when the wicked son uses similar phrasing he's scolded. This year I realized another puzzling nuance: the wicked son and one who can't ask at all get the same answer: Exodus 13:8. Why is that?

4. After enumerating the well known 10 plagues, we dive into a discussion of how many plagues occurred 'at the sea.' Surprisingly, we get a clear answer to this question in Perkei Avot 5:4: "Ten plagues did the Holy one, blessed be He, bring upon the Egyptians in Egypt and ten at the sea." Why did the Haggadah choose to leave out this simple explanation?

Here are some additional Passover resources I've been loving:

  • Both a modern interpretation from Haggdot.com and the 17th century commentator, Naftali Seva Ratzon note that the passage V'he Shemadah starts literally with: "And She" and have innovative commentaries based on this.
  • This is an impressive breakdown of the plague count using different biblical sources. Spoiler alert: no one source says there was 10 plagues.
  • I love this unexpected perspective on the 'Pour out thy wrath' section of the Seder. More than ever I see these verses a barometer for how accepted we feel as a people. When 'Pour out thy wrath' feels awkward, it means we're doing well; when it resonates we know just how insecure our times our.
  • In Megillat Esther, the d├ęcor at Achasverosh's feast includes the phrase: 'cotton [wall] hangings'. The Hebrew for this phrase uses the word 'Karpas.' And boom, just like that, you can now link Passover and Purim.
  • Here's a copy of the Haggadah with the relevant Talmud sources included inline. I love how this gives additional context to the Haggadah, showing purpose to many of the seemingly random things we do during the Seder.
  • This "Feminist Supplement to the Haggadah" may have a seemingly provocative name, but the content is both well thoughtful and powerfully written. Check it out, I think it would be a beautiful addition to any Seder.
  • Hallel, which we recite at the end of the Seder, is made up of psalms 113 to 118. This fact is obscured by the way the text is paginated. By splitting up the paragraphs just so, we can emphasize different parts of the text and give a unique feel to the experience of reciting these six psalms. How and when was this pagination developed? I've Googled but couldn't find an explanation. I asked Chat GPT and it immediately gave a plausible answer. When I try to confirm the facts Chat GPT provided by additional Google Searches I still come up empty. Thus I find myself with yet another new question this year: Should I trust Chat GPT?

Wednesday, March 29, 2023

This Bud's For You

Running along the Mount Vernon Trail this past weekend it was impossible to not stop and take pictures of the budding and flowering trees. Just because this happens every year, and "that's how trees and plants work," doesn't mean it's not amazing spectacle to behold!

Bring on the seasonal alergies!

Wednesday, March 22, 2023

But Does It Amplify Audio?

I've finished building the first stage of my Elenco AM/FM radio kit, which is an audio amplifier. The build instructions now recommend a series of tests using a multi-meter, audio generator and oscilloscope. While I'm all for doing these formal tests, I couldn't help but take a detour and try my own more casual experiment.

Here's my thinking: if I've built an audio amplifier, doesn't that mean it should amplify audio? That is, if it I take an audio signal from my cellphone's headphone jack, shouldn't I be able to hear it over the speaker? I really wanted to find out.

I picked up a set of these audio jack adapters that allow you to connect arbitrary wires to any 3.5mm headphone jack. Using a bit of hookup wire and some alligator clips, I connected one lead of the headphone cable to ground , and the other lead to the audio amplifier's input.

On my cell phone, I switched over to YouTube and hit play on a video. I then cautiously turned on the radio, increasing the volume every so slightly. And....

Success! I could hear the cellphone's video playing through the radio's audio amplifier. Whoo! I'm #1, I'm #1!

To anyone with even a bit of electronics experience, I'm sure you're shaking you're head. I'm using an audio amplifier to amplify audio; of course it works. And technically, I didn't even build the audio amplifier. All I did was wire in an audio amplifier chip (an LM386N) to a speaker with a few resistors and capacitors to help it out.  But still, to have my mental model match up to hardware I've personally built was quite a rush!

Next up: I'll get a bit more technical and the measure gain of the amplifier I've built. This is fun!

Monday, March 20, 2023

Lessons from the Electronics Bench: Trust Nothing.

I've finished building the first stage of my Elenco AM/FM radio kit. One of the key features of the Eleneco kit is that it comes with instructions for testing each module that you've built. This helps ensure you don't get too far along in the build process before discovering issues. More importantly, it helps ensure that you understand what you're actually building, which for me is what this exercise is all about.

One of the first tests I was supposed to run was the 'Output Bias Test.' Basically, you pop in the battery and turn the radio on. You then check the voltage coming out of the audio amplifier I just built.

Even as a electronics novice I could appreciate that this test was confirming that at least power was flowing through the radio.

I grabbed a random 9 volt battery from our battery pile. I plugged it in. I turned on the radio and used my volt meter to test the output. Nothing.

I didn't panic.

I looked over the circuit and realized I'd never installed the IC amplifier into the IC socket. I did this and repeated the test. Still nothing.

I looked over the circuit, all seemed fine. Then it hit me: I bet this random battery is dead. I poked around and found a sealed package of Duracell, 9 volt batteries. Now we were talking. I popped one of those into the radio.

Nothing. The volt meter still read 0.

Hmmmm.

If this were a software problem I'd debug it by picking something that I knew was true and confirming that it was so. I knew very little about the circuit I'd just soldered together, but I did know that a 9 volt battery should be spewing out 9 volts. So I tested the batteries.

The first, sketchy battery, was indeed dead. It read 1 volt when I measured it with my volt meter. To my surprise, the second battery wasn't much better: it was brand new, but read only 4 volts.

I grabbed another from the package and tested it: 8.8 volts. That seemed better. I put that battery in the radio and turned it on. A got a hum from the speaker! And check it out, here's my volt reading from the audio amplifier's output:

The manual says that my meter should read between 3 and 6 volts. My meter read 4.34. Success!

Lesson learned: Trust Nothing.

Before you boycott Duracell, take a closer look at the above pic. The expiration date of my new-in-box battery was 2020. Yikes, those are ancient. No wonder the first was a dud. Onward!

Friday, March 17, 2023

Who Needs Cherry Blossoms? Some Love for Flowering Magnolias

Around here, Cherry Blossoms tend to get all "Spring is here, look at these gorgeous blooming trees!" love. But for me, it's the flowering magnolias that steal the show.

Magnolias evolved so long ago, they predate bees as pollinators. Instead, beetles do the job. And because they were around in the Cretaceous Period, T-rex's would also have enjoyed their beauty. Rwaaaar!

The purple flowered magnolias are Magnolia liliiflori. liliiflora mean 'flowers like a lilly' and explains their common name of 'Lily Magnolia.' The white flowering magnolia is an example of Magnolia stellata,or 'Star Magnolia.'

These magnolias are especially dramatic because their flowers bloom before they have leaves. This is known as precocious flowering and is no doubt a technique the magnolias use to attract pollinators. It certainly attracts my camera.

A popular set of magnolia cultivars (crosses from different types of mangolias) are known as the girls. These 9 varieties were created just a few miles from where these photos were taken, at the National Arboretum in the 1950's. A keen eyed observer may be able to tell you one magnolia is an 'Ann' while another is a 'Ricki.' The names come from the daughters and wives of various employees at the arboretum. How 1950's.

Tuesday, March 14, 2023

An Axestastic Good Time

This past weekend we went axe throwing at DC's Kick Axe and it was *awesome*. This was a new experience for the four of us, and everyone had an excellent time.

Axe throwing is exactly what it sounds like: you rent a lane and for an hour and hurl axes at a wooden target. I'm sure my country brethren are laughing their butts off at the idea of paying premium prices for the privilege of throwing a common tool at a piece of plywood. Heck, I'm wondering if I couldn't set up my own axe throwing lane in my back yard. But regardless, it was a blast.

Axe throwing requires enough skill and luck, that it's not trivial to master, so nobody got tired of trying. At the same time, it's low skilled enough that we could all have moments of glory doing it, and it doesn't require a ton of concentration.

Kick Axe itself was non-smoking, clean and had a low enough noise level that it was easy to carry on a conversation. The food was OK, with the tacos and macaroni and cheese bites serving as stand outs. The chips and salsa and pretzel (that came without mustard or a dipping sauce) were passable. The only issue was our server came by once to ask us for an order and once to deliver the food. After that, we never saw him again. We couldn't even find him to pay for our food (we flagged down another server to pay). So yeah, the service that night wasn't great. But we weren't there to eat and drink: we were there to throw axes and that we did!

We split into teams and played to 21, following the rule that if you go over 21 you reset back to 15. Hitting precisely 21 is trickier than it sounds. Everyone except myself managed to land at least one bullseye; Shira had an impressive double-bullseye as the night wrapped up.

All in all, a great time and I'd go back in a heartbeat!

Monday, March 06, 2023

Warming Up My Soldering Skills: Building Hue

To understand the electronics behind radio, I need to build a radio. But before I can build a radio, I need to have basic soldering skills. So, to that end, I picked up Hue, a small 'learn to solder' project that would let work on these skills.

Before Hue arrived, I hit YouTube to watch a number soldering tutorials. Here are some of my favorites:

The last video is a handy source for cheap, yet still recommended, electronics tools.

Surprisingly, my favorite 'learn to solder' video is this one. I say surprisingly because the purpose of this video isn't to teach technique. What I found impressive was just how casually the author of the video solders 40 header pins to his Raspberry Pi Pico. I assumed 40 nearly-touching pins would have required brain-surgery level detail and accuracy. Not so. The author makes the process look simple: heat up the pad and pin, touch with solder, and go on to the next one. It's this simplicity-first approach that's on display in the video and I realized is what I should be striving for.

When my Hue arrived, I was ready to put my newly acquired knowledge and mindset to work. I warmed up my soldering iron and put the first resistor in place on the board. I touched the tip of the iron to the leg of the resistor and the pad. After a few seconds I touched the solder to another part of the pad. And...nothing. The solder would not melt. I fiddled with different combinations, but I couldn't get the solder to flow like all the demos I'd seen. Ugh.

Not exactly sure what to try next, I ordered some lead based solder off of Amazon. That seemed to help significantly and I was able to proceed with building Hue.

Ultimately, I managed to assemble Hue a minimal of drama. I even managed to seat the LED properly, so I didn't find myself reversing the one component that needed to be placed a particular way.

When Hue was assembled I slid the battery into place and turned it on. Nothing. As I slid the battery mostly out of the slot, Hue lit up. Apparently my soldering was fine, it's just that the battery wasn't making quality contact with the board itself.

Building Hue was a gratifying experience. The small board and close together contacts made for a nice beginner challenge. Having only 9 components, one of which had polarity, also fit with the beginner theme. I could see using Hue as a nightlight when we travel, which means that Hue may very well have a life beyond this learning exercise.

I don't love that the battery holder design seems too fragile. And more than that, I wish there were an explanation about what each of the electronic components do and why they were selected. Writing up these details would add almost no cost to the project and would dramatically increase its value.

The real question is: am I ready to tackle my radio project? If anything, Hue has shown me just how far I have to go before I'll be comfortable with a soldering iron. Still, it also showed me that this isn't rocket surgery and I can muddle through. Enough prep, let's build a radio!

Wednesday, March 01, 2023

Finding a Needle in a Map Stack | Using a Field Expedient Local Map Repository

Suppose I'm standing at a trail head in Shenandoah, National Park, and in my haste I forgot to download maps for our hike and have no cell signal. My options seem limited: wing it and do the hike without a map; or abort. Neither option is great. Fortunately, I've got an SD card in my bag with thousands of local USGS maps stored at the ready. So all is not lost.

Using either my phone's GPS Test app or my watch's navigation app, I determine my latitude and longitude. Thankfully GPS doesn't depend on cell phone signal, so chances are good I'll have access to it.

For this example I'm using the coordinates 38.380411, -78.516653. I grabbed these from a Google Map.

Next up, I open a Termux session on my phone and use the usgsassist script to wade through the 3000+ local maps to find the 9 I'm interested in. That is, the quadrangle that contains my current lat and long, and the 8 surrounding quadrangles.

$ usgsassist -a contains -f ../PA_VA/area.maps -l 38.3804,-78.5166 > area.maps
$ usgsassist -a neighbors -f ../PA_VA/area.maps -l 38.3804,-78.5166 >> area.maps
$ cat area.maps
Elkton East, VA|2022-09-28|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/VA/VA_Elkton_East_20220928_TM_geo.pdf|-78.625|38.375|-78.5|38.5
Tenth Legion, VA|2022-09-21|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/VA/VA_Tenth_Legion_20220921_TM_geo.pdf|-78.75|38.5|-78.625|38.625
Stanley, VA|2022-09-15|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/VA/VA_Stanley_20220915_TM_geo.pdf|-78.625|38.5|-78.5|38.625
Big Meadows, VA|2022-09-21|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/VA/VA_Big_Meadows_20220921_TM_geo.pdf|-78.5|38.5|-78.375|38.625
Elkton West, VA|2022-09-28|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/VA/VA_Elkton_West_20220928_TM_geo.pdf|-78.75|38.375|-78.625|38.5
Fletcher, VA|2022-09-21|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/VA/VA_Fletcher_20220921_TM_geo.pdf|-78.5|38.375|-78.375|38.5
McGaheysville, VA|2022-09-15|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/VA/VA_McGaheysville_20220915_TM_geo.pdf|-78.75|38.25|-78.625|38.375
Swift Run Gap, VA|2022-09-21|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/VA/VA_Swift_Run_Gap_20220921_TM_geo.pdf|-78.625|38.25|-78.5|38.375
Stanardsville, VA|2022-09-21|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/VA/VA_Stanardsville_20220921_TM_geo.pdf|-78.5|38.25|-78.375|38.375

I grab these maps from their SD card storage using fsops.

$ (cut -d'|' -f3 area.maps | while read url ; do basename $url ; done) > area.files
$ cat area.files
VA_Elkton_East_20220928_TM_geo.pdf
VA_Tenth_Legion_20220921_TM_geo.pdf
VA_Stanley_20220915_TM_geo.pdf
VA_Big_Meadows_20220921_TM_geo.pdf
VA_Elkton_West_20220928_TM_geo.pdf
VA_Fletcher_20220921_TM_geo.pdf
VA_McGaheysville_20220915_TM_geo.pdf
VA_Swift_Run_Gap_20220921_TM_geo.pdf
VA_Stanardsville_20220921_TM_geo.pdf                                                                                                                        $
$ mkdir pdfs
$ for f in $(cat area.files) ; \
   do \
     fsops cp /mnt/media_rw/3A13-C9A7/PA_VA/$f /sdcard/Maps/Trailhead/pdfs/ ; \
   done

Finally, I load the 9 maps of interest into an Avenza Maps Collection:

With the maps loaded, the hike is a go. Onward!

Tuesday, February 28, 2023

Finally: USB Thumbdrive Access from within Termux

One maddening exercise in Termux is inserting a USB Thumb drive into your phone: it will be recognized by Android, but invisible to Termux.

See, My Files on my S22 Ultra recognizes the USB reader:

Termux, despite re-executing termux-setup-storage, doesn't.

Grrrrr.

The usual suggestion to overcome this shortcoming is to root your phone; something I'm not ready to do (yet). Thankfully, after years of running into this issue, I finally found an easy, no-root, work around. Here's the fix in action:

In the above screenshot, you can see I'm interacting with the USB thumdrive via the command fsops and the path /mnt/media_rw/B601-0C66.

fsops is my own creation, which you can find on github. It supports listing, copying, cat'ing and removing files. It plays nice with other bash commands so you can use it as part of one-liners or scripts in general.

fsops works because of two truths. First, Tasker, like my phone's file browser, can see USB drives. When I launch a File Select action in Tasker, it let's me click on the icon in the bottom right corner to browse the USB drive:

Incidetanlly, that's how I learned the magic path /mnt/media_rw/B601-0C66.

Next, it's possible to invoke Tasker from Termux's command line (including from within a proot'd Linux instance). This post explains how. The mechanism in use here is Android intents. You can set up a Tasker profile to listen for net.dinglish.tasker.Xyz and then invoke:

am broadcast --user -a net.dinglish.tasker.Xyz

To call the Xyz profile. fsops invokes tasker with the following parameters:

am broadcast --user 0 -a net.dinglish.tasker.FileSystemOperation \
	-e operation "$op" \
	-e outcome "$outcome" \
        -e error "$error" \
	-e src "$src" \
	-e dest "$dest" > /dev/null

op is set to the operation I want to perform and the remaining variables are set to files that will either be set by the user or filled in by fsops.

am broadcast delivers data to Tasker, which invokes my file system operation of choice. am broadcast makes no promises about when the task will be finished. To overcome this limitation, fsops passes a path in the variable $outcome and polls the existence of this file to detect when the task is done. While a bit on the brute force side of things, it does work well.

You can grab fops here, and the Tasker resources here. Once set up, that thumbdrive will finally be available in Termux. Whoo!

Friday, February 24, 2023

Termux::API Commands From a Prooted Ubuntu Instance

You can trivially run an entire Linux instance on your Android device by installing Termux, and then using proot-distro to install Ubuntu. The process sounds complex, but all the heavy lifting has been done by others. You don't need to buy anything, root your phone or take any other unusual steps. It's truly amazing.

One quirk of this setup is that once I launch Ubuntu, I lose access to Termux::API's Android specific commands. These commands let you interact with your phone from the command line in novel ways, like sending text messages or using the built in camera to snap photos.

For example, from within Termux I can ask what my phone's volume is set to:

Entering this command at an Ubuntu prompt gives a 'command not found' message. To which I say, of course it's not found; Ubuntu's running under Termux, so it doesn't know anything about Termux.

My usual work around for this is to launch two terminal instances within Termux: one running Ubuntu, the other standard Termux. But having two instances is clunky, and more often than not I don't make use of the Termux::API commands.

Today, I finally Googled around to see if anyone else has had this problem. Of course others have, and this discussion suggested that accessing Termux commands from within Ubuntu was doable. The answer hinged on file systems being properly mounted, something that sounded complex. Still, I hoped for the best and checked if /data/data/com.termux was available from within Linux.

It was! Under that directory were all the files that are found in Termux. I then added the following to my .bashrc on Ubuntu:

    export PATH=$PATH:/data/data/com.termux/files/usr/bin/

I reloaded my bash environment and to my surprise and joy, all the Termux commands, as well as my Termux home directory files, were now available to me.

What a great example of a failure of imagination: I assumed these commands weren't available to me, so they weren't.

Wednesday, February 22, 2023

Review: Here Goes Nothing

As soon as I clicked 'borrow' in Libby, I congratulated myself for deciding to listen to Eamon McGath's Here Goes Nothing: A Novel. A glance at the book's blurb told me that I'd be getting a glimpse into life on the road with a touring band. I'm always curious how people deal with the grind of travel, and a band that needs to perform night after night, would surely have useful insights for dealing with these challenges.

Within a minute of listening to the text, I had to reset my expectations. This wasn't an organized narrative of a band's adventures; this was a glimpse into chaotic exploits held together by alcohol, drugs, a reckless disregard of life, property and social norms, and more alcohol.

Here Goes Nothing interweaves at least two touring experiences, one early in our protagonist's career, the other later. While there's clearly growth--the van gets fancier, the recklessness is dialed down a tad--not a whole lot changes. And that's probably the point: the life of a touring band is like many big investment, big payoff endeavors: long stretches of exhaustion, boredom and fatigue, punctuated by moments of immeasurable joy and excitement.

Compared to the plodding and predicable story I just finished, I found the confusion and disorientation of McGrath's tale to be a welcome change.

The audio version of Here Goes Nothing makes frequent use of musical playing over the narrator. While this can be disorienting, the effect it has on mood is substantial. Without fully appreciating it, the music can work with the story to build intense tension and then change to reinforce the relief that the text delivers. It certainly adds depth to the telling of the story, and seems more than appropriate in book about the pursuit of the perfect musical performance.

Ultimately, I got more than I bargained for in McGrath's story. I was hoping I might pick up some tips about navigating life on the road. What I found instead was the opportunity to wrestle with some of life's biggest questions: how far should one go to pursue one's passion? What happens if your passion is also your poison? Is chasing your glory days commitment to excellence, or a fool's errand?

It's easy for me to shake my head and say dude: just let it go. The drugs, the drinking, the wear on your body and mind--it's just not worth it. But I can see in McGrath's narrative the reflection of all great pursuits; they're hard but the pay off makes it worth chasing. So as much as I want the characters in Here Goes Nothing to retire, I can't help but encourage them: Rock On!

Monday, February 20, 2023

I've Got The Whole Commonwealth In My Hand | Crafting and Visualizing an Offline Map Repository

I want to create an offline library of USGS Topo maps that will serve as a navigational backup for my local area. Whether I find myself at a trail head without downloaded maps, or some cataclysmic event has disabled mobile data access, I want a reliable source of high quality maps. Using my usgsassist script and newly implemented map compression, I can easily grab and store large swaths of maps on a single SD card. So creating this repository should be a breeze.

The first question is, what's my local area? I'm located in Northern Virginia, and for this exercise I decided to cast a (very) wide net. I opted to grab all the topo maps from the northern boundary of Pennsylvania to the southern boundary of Virginia. That's almost 6 hours of driving in any direction. Surely that's overkill for my 'local area,' but having a broader area adds to the likelihood that this repository will save the day.

You can grab the latest version of usgsassist from github.

OK, let's build this!

Building the Library

# Grab a list of maps in the area of interest

$ usgsassist -a topos -l "PA, USA; VA, USA" > area.maps

# Spot check the list

# Looks like we got them all, from: Abilene to Zelienople. $ wc -l area.maps 3363 area.maps $ head -3 area.maps Abilene, VA|2022-09-14|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/VA/VA_Abilene_20220914_TM_geo.pdf|-78.625|37.125|-78.5|37.25 Abingdon, VA|2022-09-16|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/VA/VA_Abingdon_20220916_TM_geo.pdf|-82|36.625|-81.875|36.75 Accomac, VA|2022-08-31|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/VA/VA_Accomac_20220831_TM_geo.pdf|-75.75|37.625|-75.625|37.75 $ tail -3 area.maps Zanesville East, OH 2019|2019-12-02|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/OH/OH_Zanesville_East_20191202_TM_geo.pdf|-82|39.875|-81.875|40 Zanesville West, OH 2019|2019-12-03|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/OH/OH_Zanesville_West_20191203_TM_geo.pdf|-82.125|39.875|-82|40 Zelienople, PA 2019|2019-09-04|https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/PA/PA_Zelienople_20190904_TM_geo.pdf|-80.25|40.75|-80.125|40.875

# Download and compress each map

# Download each map to map.pdf # Then store the compressed map as the name provided by the USGS $ cat area.maps | cut -d'|' -f3 | \ while read url ; do \ name=$(basename $url) ; \ echo $name ; \ curl -s $url > map.pdf ; \ pdfimages -a remove -i map.pdf -o $name ; \ done VA_Abilene_20220914_TM_geo.pdf VA_Abingdon_20220916_TM_geo.pdf ...

# Copy to an SD Card

$ sudo mount -t drvfs 'D:' /mnt/d $ cp -Rv area/ /mnt/d/ 'area/' -> '/mnt/d/area' 'area/NY_Port_Jervis_North_20190923_TM_geo.pdf' -> '/mnt/d/area/NY_Port_Jervis_North_20190923_TM_geo.pdf' 'area/WV_Porters_Falls_20191210_TM_geo.pdf' -> '/mnt/d/area/WV_Porters_Falls_20191210_TM_geo.pdf' 'area/WV_Romance_20191209_TM_geo.pdf' -> '/mnt/d/area/WV_Romance_20191209_TM_geo.pdf' ...

After a lengthy, but thankfully unattended downloading process, all 3,363 maps downloaded to my laptop. I was able to put these maps on a single 128GB SD card with space to spare. I confirmed that I can access the map files from my cell phone via an SD card reader:

So now what?

While it's comforting that I have this repository, there are issues with it. The most glaring one being: how would I actually use it? More specifically, how would I find the few maps of interest out of the 3,000+ that are on the SD card?

I'll be answering that question in a future post. For now, I want to tackle a simpler question: what area does this library cover?

I'm confident that the maps from 'northern Pennsylvania' to 'southern Virginia' has me covered, but what does that area include?

I searched for web services that would let me visualize this, and ultimately landed on a delightfully simple option: the Google Static Maps API.

This API is allows you to craft a URL that describes the map you're looking for and Google will serve up an image of said map. How have I never used this capability before?

I implemented usgsassist -a preview by creating a Static Maps URL that includes a path definition which outlines the area of interest in purple. The path coordinates are made up of the bounding box returned by usgsassist -a geobox. This sounds complex, but it turned out to be straightforward to implement.

Here's the URL generated by my map library's bounding box (minus my Google Maps key):

$ usgsassist -a preview -l "PA, USA; VA, USA" | sed 's/key=[^&]*/key=XXX/'
https://maps.googleapis.com/maps/api/staticmap?size=500x500&key=XXX&path=color:purple|42.5141658,-74.6895018|42.5141658,-83.675415|36.5407589,-83.675415|36.5407589,-74.6895018|42.5141658,-74.6895018

Here's the corresponding image Google generated:

Sweet, right? This URL can be trivially passed to curl to download the image. I've stored the image on the SD card with the maps to provide additional context.

$ curl -s $(usgsassist -a preview -l "PA, USA; VA, USA") > ~/dl/area.png

In general, this preview command takes the guess work out of figuring out what area usgsassist -a topos is going to include.

Next up I'll tackle the challenge of actually using this map library.