Monday, October 6, 2014

Daily Dose of MODIS

I've written previously about the MODIS satellites and their constant imaging of the planet; CalTopo's fire activity layer is derived from their infrared sensors, with a lot of post-processing by the federal government.  There's now a new pair of layers that make use of the visible-spectrum sensors: current and archived MODIS imagery.

The Latest MODIS layer can be found under the Aerial Imagery group.  Imagery is acquired twice a day, but note that the first pass may not happen until the afternoon.

All quiet in California, but a little foggy on the coast.

The layer has a nominal resolution of 250 meters / pixel, but since the imagery is often not tack sharp, usable resolution will be less:

Not quite enough to read license plates.

The latest image may be covered with clouds, or the area you're interested in may be especially blurry if it was at the edge of an imaging strip.  That's where the archived imagery comes in, as a new configurable layer option:

Choose which pass you want (the satellites are named Aqua and Terra), the date you want imagery from - today, yesterday, or any day back to May 2012 - and you're off and running.

You may be thinking "so this is a fun toy, but how does such a low resolution image help with backcountry trip planning?"  To answer that question, lets dial the clock back a couple weeks to September 16, when the King Fire was going strong:

CalTopo's fire activity layer pulls in smoke polygons from a separate source, but there's nothing like seeing it with your own eyes.

As another exercise, a light storm blew through the Sierra shortly before some friends headed to Desolation Wilderness last fall.  They asked me how much snow to expect, and I erroneously under guessed as Truckee had already melted out several days prior.  If only they'd had easy access to MODIS imagery, it would have been obvious that their destination was still coated in a thin layer of the white stuff.  As an added bonus, you can make out smoke plumes from controlled burns along the western slope of the Sierra:

This has barely gone live and I'm already in the habit of checking it once a day, just to see if anything interesting is going on.

Monday, September 8, 2014

End to End: Closed Contour Yosemite Maps

A few years ago, I ran across Dan Cervelli's excellent Closed Contour map of the Sierra.  At the time I was just getting started with CalTopo and learning my way around GIS, and Closed Contour really opened my eyes to the cool stuff you can do with Mapnik.  I had no idea it was so simple to take some shapefile data, add a few rendering commands, and then boom, beautiful looking maps.  At least, the tools are that simple - obviously there's still a lot of talent and hard work involved in producing the final product.

The original Closed Contour map was built on a projection and tiling system incompatible with Google Maps, so integration into the universe of sites and apps using that as a de-facto standard was not possible.  Dan has a new Yosemite map built around this standard, and I thought it would make a great end-to-end demo of some things CalTopo can do with "web mercator" tile sets.

Step 1: Add a Custom Layer

The more maps, the better - CalTopo is built around the idea of combining different map layers into a single coherent picture.  Unfortunately, I have to balance supplying layers of regional or special interest against providing a reasonably compact, easy to navigate UI.  The middle ground I've settled on is to make it easy to add custom layers from a tile URL or WMS address.  You can also choose from a preset list of useful layers, which Closed Contour has now joined:

Closed Contour now appears in the layer dropdown alongside the standard CalTopo layers

and provides a snazzy backdrop for some route planning, complete with trail mileages

You can also skip these steps and just visit to take a look.

Step 2: Make a PDF

I've already covered printing multipage PDF map packs and loading Geospatial PDFs onto your smartphone, so lets just jump ahead to the results:

The Half Dome hike fits onto a single 1:24k scale 8.5x11 print.  Compare Closed Contour, above, to the USGS 7.5' topo below:

I can also load this into Avenza PDF Maps to plot my location and record tracks when out in the field:

Step 3: GPS and Google Earth

Both Google Earth and newer Garmin GPSs know how to read layers exported from CalTopo as KMZ files.  So lets go make one:

This gives me a better GPS map of Yosemite than money can buy:


And some pretty nice 3-D visualizations:

Friday, August 15, 2014

PDFs get Geospatial

Printing Geospatial PDFs that can be used in programs like Avenza PDF Maps is an oft-requested feature that's been hanging over my head for some time.  Having looked into it and abandoned the effort, I've lived life dreading the prospect of wading back into the fray.  However I took another crack at it this week and, armed with a better understanding of the PDF spec, it turned out not to be so bad.

Starting now, all single-page PDFs generated by CalTopo are Geospatial PDFs.  Edit: Looks like I jumped the gun a bit.  There were some compatibility issues with the iOS version of Avenza that have now been fixed.

Complementing this is a new short-URL feature that makes it easier to share CalTopo PDFs or load them onto a phone.  Step 1 is, as usual, to click Print and then Create a PDF:

Underneath the Generate PDF button is a new Generate Link button.  This behaves just like Generate PDF, but instead a new browser tab opening with a long query string or a blank form post, it opens with a short URL.

Anyone with this URL can now download your PDF; no need to save it to a computer and then share using a 3rd part hosting service.  While the print page indicates that links expire in 30 days, I may keep them around longer if they don't occupy too much space - currently I have to go in and purge them manually.

The only reason for a separate Generate Link button is to avoid cluttering my database with PDFs that will never be shared.  If that proves to be a non-issue, I'll merge them into one button that always generates a short URL.

I have no affiliation with Avenza, but their free PDF Maps app allows you to import directly from the CalTopo URL:

Thursday, June 19, 2014

Revised Marker Icons

In keeping with the recent line style update, I've made some changes to marker icons.  While a few icons have been added, the focus was adding colorability and rotatability, and laying the groundwork to add additional icons at a later date.

Instead of showing all possible icons, the marker dialog now shows the icon's style, and optionally its color and orientation.  Click on the style swatch to bring up a full-screen dialog similar to the line style dialog:

Mostly this is a retread of the previous set of icons.  A few wildland fire icons have been added, along with a letter-in-circle option.  However unlike the previous all-in-one dialog, this one has room to grow.

The color and orientation sections are selectively enabled for icon styles that support them.  Currently color is supported for all the circle and arrow icons, and rotation is supported for arrows and the wildland fire line breaks.  Click on the color swatch to bring up a color picker, just like with lines and polygons.

For icon styles that support rotation, you can set the orientation by entering a number of degrees, or by clicking on the axes overlaid with a directional arrow.

Thursday, May 29, 2014

USGS Stream and Reservoir Gauges

Building on the code already in place for Snotel, I'm pleased to announce another real-time datasource: USGS water gauges.  While it's more of a frontcountry source than a backcountry one, streamflow information can still give you a good picture of the snowmelt situation and help determine whether rivers are easily crossable.  Of course boaters use it all the time, but large rivers only make up a small portion of the network, and those gauges are better covered by sites like

that's a lot of gauges

There are 7500 stream and reservoir gauges, v. 850 snotel sites.  I haven't modified the code to be more selective about how many stations get displayed at once, so users with slower, older machines may find their browser slowing down after enabling the water gauge layer.  If this proves to be problematic, let me know - if enough people complain, I'll look into fixing it.  On my 3 year old laptop, it was a non-issue.

Much like the snotel layer, zooming in displays the current real-time value for individual gauges.  Streams show the flow in cfs (cubic feet per second), and also the water temperature in degrees F, if available.  Reservoirs show the current capacity in acft (acre feet).  When you mouse over a station, the tooltip shows the time at which it was last updated.

Click on a station to bring up a graph of the last week.  Cubic feet per second is in blue, degrees F in red, and acre feet in black - although no station will support all 3 values at once.  Mousing over the graph brings up a vertical bar and provides the time and reported values at that point.  Because station update frequency varies, there is no time range selector like with the snotel sites, at least for now.

The layer is available via the "Water Gauges" checkbox underneath the Snotel layer, or click here to try it.

Tuesday, May 13, 2014

New Fire Activity Layer

As the summer fire season approaches, I decided to take another look at integrating current fire activity with CalTopo.  There's a wealth of government supplied fire information out there, and I've long thought about integrating this into a custom source that plays well with CalTopo's other map layers.  When the MODIS layer I'd previously been using went down and stayed offline for several months, it gave me the nudge I needed.

The old MODIS layer has now been replaced by a "Recent Fire Activity" layer which pulls data from several different sources.

The first of these sources is, no surprise, MODIS detections.  The MODIS system consists of two satellite imagers (Aqua and Terra) that take daily multispectral imagery of the planet; the IR band can be used determine surface temperature and, from that, detect wildfires.  Wide swaths of imagery are taken at approximately 10:30AM and 1:30PM local time; while they don't follow timezones exactly, the East Coast is imaged 3 hours before the West Coast.

The Forest Service's Remote Sensing Applications Center processes MODIS images into wildfire hotspots and makes the locations available at  While there are other sources available that have better global coverage or a faster update time, the RSAC dataset has additional metadata I couldn't find elsewhere, like the actual observed surface temperature.

Edit: Shortly after this post, Southern California saw a bout of fire activity, unfortunately giving me an opportunity to put the RSAC data through its paces.  Due to the time lag between satellite passes and their shapefile updates, I've switched to a new NASA Source which still includes temperature observations.

Starting at a wide zoom, these detections appear as multicolored Xs and *s on the map.  I wanted to convey two different attributes, severity and recency, so I needed to vary both the color and symbology.  Government maps use a red->orange->yellow color gradient to indicate the age of MODIS detections, and I decided to follow that for consistency.  Red spots were detected in the last 12 hours, orange in the last 24 and yellow in the last 36.

The asterisks represent hotter, more likely hotspots, while the Xs represent colder, less probable spots.  Zoom in a little further and each spot is marked with its average temperature.  In busy locations this can get a little crowded:

Each MODIS pixel is at least 1km square, sometimes larger, and the surface temperature is an average across the entire pixel.  So a 122 degree spot could be small, intense hotspot or a large, smoldering fire.  As the temperature drops, the certainty that there's a wildfire there drops; based on this and presumably other factors I don't understand, the RSAC assigns a confidence number to each detection.

At high zoom levels, detections are represented as a circle with additional information.  The X and Y dimensions of the MODIS pixel are averaged to get the circle's radius, so the circle shows approximate coverage size.  The detection date - which may be later than when the hotspot actually started - is shown in Mountain Daylight Time (MDT), regardless of actual timezone.  Temperature and confidence are given on the next line, followed by the satellite that made the detection and the center that processed it (RSAC or GSFC, for the Goddard Space Flight Center).

Another data source I'm pulling in is smoke polygons from NOAA's Office of Satellite and Product Operations.  Color (gray->black) represents smoke severity, while crosshatching is used for current smoke and empty polygons show where the smoke was several hours previously.

The final source is large fire perimeters from GeoMAC.  Unlike the previous two products, which are based on satellite data, fire perimeters are manually reported by an incident's management team.  As a result, they seem slow to update and I'm on the hunt for a more reliable source.  In the meantime, I'm marking perimeters with the last date at which they were updated, in addition to the incident name, so that you know how recent/reliable the data is:

Because fire season is just ramping up, I haven't had the opportunity to test this layer as thoroughly as I'd like.  Normally I wouldn't add it to CalTopo until I'd had the chance to vet it more thoroughly, but since the MODIS layer already on the site was still having issues, it made sense to sub this in as quickly as possible.  Expect things to change, and please send me any feedback or bug reports.

Tuesday, April 29, 2014

Line Modification

Tips for creating a line - like dropping points, freehand drawing and undo - were previously covered in this blog post.  Options for modifying existing lines have slowly been growing, and I think it's time to take a detailed look at them.

All of these options are accessed by right clicking on an existing line.  Vertex dragging is also enabled when clicking the edit icon in the left bar.

the right click context menu

The first option I want to cover is "Clone As".  This allows you turn a line into a polygon, add a styled line that matches a polygon border, or simply backup an existing line before editing or resampling:
right click -> Clone As -> Line.  Done.

Vertex dragging has been around for a while but it's worth a quick look.  Right click - > Modify -> Drag Vertices.

At this point each vertex along the line or polygon gets a draggable white circle.  Midpoints between vertices also get a partially transparent circle, which you can drag to create a new vertex.  To delete a point, right click on it and choose Delete Vertex.

When you're done modifying the line, right click on it and chose Save Changes - or, if you made a mistake, Discard Changes.

Sometimes it's useful to break a line in two - say to delete a bunch of points at once, or to get around a GPS' limitation on the number of points per route.  To do this, simply right click on a line at the point where you want it split, and choose Modify -> Split Here.

The opposite of splitting is joining.  To join lines,  one of the two must have a label.  Right click on the unlabeled line and choose Modify -> Join Lines.

A dialog will come up asking what line you want to join with.  If the two lines don't touch, CalTopo will automatically pick the best way to connect them.

Drawing a freehand line creates a lot of points.  This can exceed the limits of your GPS, resulting in only getting part of a route.  It also creates jitter, since no one has perfectly steady hands.  You can work around these problems by resampling a line, reducing the total number of points.

You can shrink a line down to a fixed number of points, or to create points at a fixed interval like 500 feet.  You can also optionally add a marker at each resampled point, in order to load them as waypoints onto a GPS.

Finally, you can reverse the order of a line so that directional styles will point in the opposite direction.