Texas Parks & Wildlife Drive Time & Distance Calculator - Shiny Contest Submission

Texas Parks & Wildlife Drive Time & Distance Calculator

Authors: Santiago Rodriguez

Abstract: Interactive Texas Parks & Wildlife resources with the ability to calculate drive time and distance.

Full Description: Years ago when I moved to Texas from South Florida I missed going fishing. I discovered that during winter months, Texas Parks & Wildlife (TPWD) stocks local fishing areas with trout. This was music to my ears. However, the static HTML table provided by TPWD wasn't conducive to getting outdoors. The problem with the static table is it only provides the fishing area and the city, and it's too tedious to search each location individually on Google Maps for example. So, I built a Shiny app for myself and hosted it on ShinyApps.io (link). The app was successful and I was able to go fishing. The main goal of this version was to help me find the nearest fishing location and to be able to sort and filter locations.

Recently, I decided to learn more about putting a Shiny app in production. I decided to focus on the TPWD trout POC I built years ago because I thought others could benefit from having a better interface to the trout stocking data. The scope of the app expanded beyond just the trout stocking data though as I realized that other TPWD resources were useful but not interactive. The static nature of the resources might deter some people from getting outdoors. So, I built this Shiny app.

The goal of this app is to help Texans interact with Texas Parks & Wildlife static online resources and to help Texans get outdoors.

Technical Details

Functionality:

  • Interactive tables
  • Calculate drive time and distance

Tables:

  • Boat ramps
  • Catfish stocking information
  • Parks (list of state parks)
  • Trout stocking information (2023-2024 season, 2024-2025 season begins in November)
  • Wildlife management areas

Hosting:

  • AWS EC2 (free tier t2.micro)

Software:

  • Shiny (R) built with the Rhino development framework
  • HERE API for route calculation logic
  • Docker

Architecture:

  • data layer
  • web app

Regarding the architecture of the app. There are two services, a data layer and a web app. The two services operate independently of each other. This has many benefits and a few drawbacks. The primary benefit is the app is lean and efficient. One drawback is it's possible, while unlikely, that the app is live but has no data to display.

The data layer was built using Julia and imports, transforms, and writes the data used by the app (as arrow files) to an AWS S3 bucket. The app imports the arrow files from the AWS S3 bucket using reactive inputs.

The app's only calculation is outsourced to the HERE API to obtain route info, which can be slow depending on the table size. Since the app is hosted on a free tier t2.micro instance (1 thread) there is no opportunity to use fancy optimizations, such as parallelization.

The separation of the data layer and the app also helps to include new tables without interrupting the app or UX. As tables are added the app auto updates the Tables selection.


Shiny app: https://tableswebapp.thealgo.group/
Repo: ShinyContest2024 / WebApp · GitLab

Thumbnail:
image

Full image:

I entered an address of "Houston Tx 77008", calculated the distances to Wildlife Management areas, and when I sorted on distance, the nearest one was Yoakum Dunes WMA, which cannot be correct. I like the app though - it's pretty nice. Now if you just popped up a map.... :sunglasses:

Thank you, @Ajackson.

A map would be awesome! And funny enough I've thought about it too. Thanks for the feedback.

As for the directions you mentioned, I tried "Houston Tx 77008" and the nearest WMA I see is Candy Abshier WMA. When I search for Candy Abshier WMA on Google Maps says it's about 68 mins away, while the app says ~50 mins. So it's still a little off.

That is odd. Here is what I get:

@Ajackson I think you've identified an issue. As you can see in your screenshot, when users run multiple queries on the same table multiple drive time and distance columns are created. I believe this is breaking the sorting function.

I think for a better UI/ UX there should only be one set of drive time and distance columns per query. I'll see if I can push an update to address this.

Thanks for taking time to interact with he app!

@Ajackson, I've pushed an update that addresses the faulty sorting caused by multiple drive time and distance columns. Now, there is only ever one set of route info columns. Thanks again for your feedback.

Happy to be a tester.

1 Like