Friday, May 07, 2021

3 Plant Mysteries, 1 Simple Tricks for Solving Them

Last weekend we hiked the BROT. Peeking out at the base of a tree I saw this little guy:

What the heck is it?

Or consider this beauty right here. It's obviously what would be called a wildflower, but what plant is it specifically?

And check out the funky leaves of this plant. The dark green and pronounced vein pattern reminded me of spotted wintergreen. Was this spotted wintergreen or a relative?

I wouldn't consider a hike a success if I didn't walk away with a heap of question like these. And thanks to Plant Snap and Google Images it's usually possible to get them answered.

Using a new tool, however, I was able to untangle these mysteries in a single click. Here's what I learned:

Pic 1 is Conopholis americana, known as American Cancer Root, Squawroot or Bear cone. I was right to be confused as it "is a fully parasitic plant that occurs only where it can grow attached to the roots of some species of oak." It has no chlorophyll, hence the lack of any green. Technically, the plant is edible, though reports suggest it tastes awful.  The name 'squawroot' is derived from the medical benefit related to treating menopause and other lady ailments.

Pic 2 is the aptly named Virginia Spring Beauty. Apparently, they are tasty:

In his book "Stalking The Wild Asparagus" Gibbons wrote about eating them daily if not twice a day for several weeks. He said: "We tried them fried, mashed, in salads, and cooked with peas, like new potatoes. All these ways were completely successful, but, as regular fare, we preferred them just boiled 'in the jackets.' My friend grew so fond of this food that he was afraid he would experience withdrawal symptoms when the supply was exhausted." While Gibbon's friend thought they tasted like potatoes Gibbons thought they were sweeter, closer to chestnuts in flavor.

Pic 3 is most definitely not Spotted Wintergreen, and when comparing the two photos they don't look anything alike. What I found is Hieracium Venosum, known as Hawkweed or Rattlesnake Weed. Apparently, it gets it name as it thrives where rattle snakes occur. (Though no, there are no rattle snakes on the BORT). While it may have some medical benefits, they appear to be relatively obscure.

So how did I figure all this out so quickly? Why Google, of course. Specifically using Google Lens. Below are what happens when I click the "lens" button in Google Photos for these examples:

I suppose I shouldn't be surprised that Google can find web pages that contain photos that are a close match to these examples. But still, to see it in action it's hard not to be blown away.

So next time you're out and about and see some strange looking plant, give Google Lens a try. I think you'll be amazed with what you can learn.

Tuesday, May 04, 2021

A Long Walk to Image-Based-Map Story Telling

I did a bit of Yak Shaving this morning. See, I wanted to write a post about a recently discovered app feature that does an amazing job of identifying wildflowers. But, to give that post context I thought it would be helpful to put the wildflowers pics on a map. But to get photos on a map, I figured I needed to extract the lat/long from each of the images' metadata. And to extract the image metadata, I needed re-learn how to pull exif data using ImageMagick.

So while I had intended to write about wildflower identification, I found myself writing the shell script below that extracts the latitude and longitude from an image.

But my Yack Shaving didn't stop there.

My Maps Awesomeness

With the latitude and longitude derived, I then went over to Google's My Maps to figure out how I could render the photos on a map.

I opened up My Maps, clicked Import and was shocked to see that there's a Google Photos option:

I selected a bunch of wildflower pics from our recent hike and to my delight, Google precisely placed them on the map. All the work I did to extract geo location data from images was unnecessary (but I'm confident it may be handy in the future).

Wrestling with Garmin Connect

To complete the wildflower map I needed to export our route from connect.garmin.com and import it into a new layer on My Maps. Garmin, to their credit, includes GPX and KML export options and My Maps reads both these formats. This was going to be a breeze!

The export from Garmin went smoothly, but the import into My Maps failed. The export file was over 5 Megs, the size limit for My Maps. Ugh.

Looking at the export file, I noticed at least two optimizations I could make to shrink the file:

<trkpt lat="38.72506211511790752410888671875" lon="-77.3301221989095211029052734375">
  <ele>78.40000152587890625</ele>
  <time>2021-05-02T11:00:34.000Z</time>
  <extensions>
    <ns3:TrackPointExtension>
      <ns3:hr>105</ns3:hr>
    </ns3:TrackPointExtension>
  </extensions>
</trkpt>
<trkpt lat="38.725062198936939239501953125" lon="-77.33012236654758453369140625">
  <ele>78.40000152587890625</ele>
  <time>2021-05-02T11:00:35.000Z</time>
  <extensions>
    <ns3:TrackPointExtension>
      <ns3:hr>105</ns3:hr>
    </ns3:TrackPointExtension>
  </extensions>
</trkpt>
...

Those lat/lon values are crazy. There's no reason to have that many decimal points of precision. Also, the tags prefixed with n3: appear to be heartrate metadata which My Maps won't use. Running the following unix commands brought the 9.2 meg GPX file down to 4.9 meg, perfect for My Maps:

$ sed -E 's/([0-9]{6})[0-9]+/\1/g' bort.gpx |  grep -v ns3 > bort.smaller.gpx

A BROT Wildflower Map

And check it out, here's my wildflower map of the Bull Run Occoquan Trail (BROT). Pretty sweet, right?

Image Based Maps for Storytelling

The more I think about this My Maps capability, the more I'm both impressed by it and amazed I hadn't considered searching for it in the past. Viewing pictures on a map adds an impressive amount of context. It turns what may be an un-inspiring one-off picture into a fascinating collection.

Consider the difference between a photo of a meal you took while on vacation, and a map showing every meal you ate as you traveled the country. While none of the pictures themselves may be particularly special, as a whole, they would be a fun and unique way to visualize your entire trip.

I'm glad to add map based image collections to my blogging toolbox.

Bonus: Image Metadata Extraction

Here's the script I wrote to extract latitude and longitude metadata from images. It was inspired by this discussion.

#!/bin/bash

##
## help out with manipulating images
##

usage() {
  cmd=$(basename $0)
  echo "Usage: $cmd -a lat -f <img>"
  echo "Usage: $cmd -a lng -f <img>"
  echo "Usage: $cmd -a latlng -f <img>"
  echo "Usage: $cmd -a exif -f <img>"
  exit
}


while getopts ":a:f:h" o; do
  case "${o}" in
    a)
      action=$OPTARG
      ;;
    f)
      file=$OPTARG
      ;;
    * | h)
      usage
      ;;
  esac
done

case "$action" in
  lat | lng)
    if [ -z "$file" ] ; then
      usage
    fi
    
    case $action in
      lat)
        prop=GPSLatitude
        ;;
      lng)
        prop=GPSLongitude
        ;;
    esac


    raw=$(identify -format "%[exif:$prop]" $file)
    if [ -z "$raw" ] ; then
      echo "exif:$prop not found in image"
      exit
    fi

    ref=$(identify -format "%[exif:${prop}Ref]" $file)
    if [ -z "$ref" ] ; then
      echo "exif:${prop}Ref not found in image"
      exit
    fi

    deg_n=$(echo $raw | cut -d, -f1 | cut -d/ -f1)
    deg_d=$(echo $raw | cut -d, -f1 | cut -d/ -f2)
    min_n=$(echo $raw | cut -d, -f2 | cut -d/ -f1)
    min_d=$(echo $raw | cut -d, -f2 | cut -d/ -f2)
    sec_n=$(echo $raw | cut -d, -f3 | cut -d/ -f1)
    sec_d=$(echo $raw | cut -d, -f3 | cut -d/ -f2)

    loc=$(convert xc: -format "%[fx:($deg_n/$deg_d) + ($min_n/$min_d)/60 + ($sec_n/$sec_d)/3600]" info:)


    if [ "$ref" = "S" -o "$ref" = "W" ] ; then
      echo -n "-"
    fi
    
    echo $loc
  ;;

  latlng)
    if [ -z "$file" ] ; then
      usage
    fi
    
    echo -n $(imgassist -a lat -f $file)
    echo -n ","
    echo -n $(imgassist -a lng -f $file)
    echo
    ;;

  exif)
    if [ -z "$file" ]; then
      usage
    fi
    
    identify -verbose $file
    ;;
  *)
    usage
esac

Oh, and I really do plan on posting about wildflower identification. That is if I can avoid the Yak.

Monday, May 03, 2021

Hiking (nearly all) The Bull Run Occoquan Trail

Yesterday we hiked the Bull Run Occoquan Trail (aka BROT). I classify this as a One Day Trail, because every time I'd seen it mentioned I remarked that one day I was going to hike it. And yesterday was that day.

What distinguishes BROT from other local area trails is its combination of length and back-country feel. At a little over 17 miles, it's one the area's longest woodland trails. Yesterday, the weather cooperated, and we had an outstanding day of hiking.

We opted to traverse the trail from Fountain Head Regional Park to Bull Run. This was a wise decision because the Fountain Head Section has a heap of elevation gain and loss which was nice to accomplish while we were fresh. The trail was well marked, and at only two points did we find that the blue trail markings and the All Trails route disagreed. And even those cases were easy to reconcile.

Some of the AllTrails reviews painted a pretty bleak picture of the trail: claiming that the trail was overgrown, required bushwhacking or in at least two instances, suggested that you were required to make a waist-deep stream crossing. None of this is true. Except for one recently downed tree, the trail was smooth sailing the whole way. All the stream crosses had bridges or stepping stones.

We did run into one logistical glitch. When we arrived at Bull Run to drop off our car it was 6:15am and the park wasn't scheduled to open until 7am. Our fix was to park at an access point off of Route 28 about a mile into the hike. I was bummed to be losing a mile of the trail, but preferred that to scrubbing the whole adventure. Fountain Head Regional Park opened at 6am (despite Google claiming it too opened at 7am), so we had no problem parking there. We were on the trail by 7am as we hoped.

While the trail didn't offer much in terms of views, and we didn't have time to explore the history of the area as much as I'd liked, it more than made up for these losses. Much of the trail takes you along water which was both picturesque and quite inviting. There were also numerous types of wildflowers in bloom, including Virginia blue bells, Virginia spring beauty, Meadow buttercup, Golden ragwort and more. There was a variety of Azaleas blooming that looked downright spectacular. Heck, even the Skunk Cabbage looked impressive.













I also came across some unique finds, including a Pink Lady's Slipper which is a variety of orchid(!) and the odd looking and equally oddly named American Cancer Root. It was a definitely a wonderful day to be in the woods.


I also spent quite a bit of time pondering this plant right here:


She may not look like much. However, unlike most of her plant neighbors, she's destined for greatness. That's a baby Tulip Poplar. Once mature, it'll be among the tallest trees in the forest. Tulip Trees are so large that I didn't notice their distinctive leaves and flowers until one pooped on me.

Think about all countless things that have to go right for this tiny seedling to turn into a mighty tree. It seems impossible. And yet, as we hiked through the forest, we were surrounded by mature Tulip Trees. That's amazing.

Overall, the BORT is a splendid trail and one I hope to come back and explore in the future.