A Few Mapping Tips

Some More Watershed Mapping Tricks with sf and USGS code

Just to make sure that I post something at least annually, I’m jump-starting my posts again. It’s been quite a journey to finish my PhD, and I’m still re-calibrating/re-adjusting. Hopefully I’ll be posting a bit more regularly, instead of annually or semi-annually. For the half-dozen folks that actually read this, if you have additional topics you’d be interested in seeing/reading, please let me know!

But let’s get on to content before this turns into a food blog where the recipe is at the very bottom after 100 pictures of diced tomatoes and artsy grains.

Mapping with sf

About a year ago, I wrote a series of posts on using the sf and riverdist packages (among others) to do some stream analysis and make stream maps. Since that time, I feel like the capabilities and content for spatial work in R has exploded. There have been many excellent examples, and kudos to the folks tweeting, posting, and sharing all the code! If you haven’t seen some of the really fantastic visualizations and data wrangling that the USGS OWI folks have been putting out (along with the code!), you’re missing out. Same goes for many others who have posted some great stuff. Here’s just a few interesting examples:

Get a HUC Watershed Boundary

First, let’s use one of the NHD HUC boundaries that we can use as our background for grabbing other data. I’m just using something I have handy, which is HUC8 boundaries for the American/Yuba/Bear watersheds. Alternatively, thanks to the awesome folks over at USGS OWI (David Watkins, David Blodgett, Laura DeCicco, and many more), there’s already plenty of code we can adapt to use to download all sorts of NHD/Watershed things.

For example, we can use some of the code from very handy function courtesy of Laura DeCicco, in a github repository for an inactive package called hydroMap. To make that work, you’ll need a local USGS gaging station ID, as well as rgdal installed. If you don’t know a NWIS or USGS s