Sunday, November 8, 2015

MapBuilder: Pimp Your Topo

I've never been happy with CalTopo's reliance on USGS 7.5' topo scans.  While I expect them to remain the gold standard in backcountry navigation for years to come, in some places they're quite out of date.  Even when they aren't, it's difficult to use them for high level trip planning - zoom out a couple levels and it's hard to see trails or read the text.  Often I'll zoom in to trace out a trail, then zoom out to get the high level picture.

Vogelsang Pass, Yosemite.  At zoom 13, you can barely follow the trails.
I've thought about building my own map layer to address this for years.  The tools are all out there - throw an OpenStreetMap snapshot and some government datasets in a PostGIS database, write some Mapnik styles and put a tile server in front of it all.  The hard part is striking the right visual balance and making it all look good.  Should the map be crowded with details, or sparse and easy to view?  Are public/private land boundaries important, or should they be hidden?  At wider zooms, which features do you keep and which do you progressively phase out?

Much better.
On a backpacking trip this summer, I realized I was thinking about the problem wrong.  CalTopo is all about letting users customize the map they're looking at, and an in-house topo shouldn't be any different.  Instead of creating a single topo layer, I should be letting users design their own.

MapBuilder, the product of that realization, is now here - although it's still in "beta" and under active development.  Once I get things running smoothly, several pre-configured map layers will remain free, while the custom MapBuilder tool will become a pro-level feature.

As with the other custom layers, get started by choosing "Add MapBuilder Layer" under the new layer menu.  A dialog pops up with a bunch of design choices; click Save and your custom layer will show up in the dropdown next to all the others.

There are also two pre-configured layers in the Topographic Maps section of the standard layer dropdown, although their composition may be subject to change.  MB Topo looks like a basic topo map, while MB Aerial uses an aerial imagery background and drops some of the clutter, like peak names and park boundaries.

Anyway, enough with the talk, here's a quick tour.

MB Topo view of the Marin Headlands

MB Aerial rendering of the same spot

MB Topo rendering of Mt Olympus, WA
Custom Grand Canyon map that emphasizes trails.
Custom high-level planning map of Cascade Pass, WA.
Custom map of Logan Pass, Glacier National Park, MT

Some caveats:
  • The data I'm using for relief shading has some issues with wide zoom levels.  It should be fixed in a week, but until then North-facing slopes may look rough.
  • OpenStreetMap trail data includes some common cross-counry travel routes, like the Whitney MR and the DC and Emmons routes up Rainier.  So far I haven't figured out how to distinguish them from actual trails.
  • The PDF generator creates high resolution maps by zooming in and then shrinking everything down.  With layers that change at each zoom level, this makes text and features really small.  I hope to have a solution soon, so that MapBuilder layers will print acceptably.
  • Since this is under active development, existing maps may cease to work or suddenly start looking different.
  • Remember, once I get the bugs worked out, custom layers will become a pro-level feature, but several preconfigured layers will remain available.


  1. This is Fantastic Matt. How often are you planning to update your data pulled from OpenStreetMaps on Map Builder?. I noticed some of the trails from OpenStreetMaps are not the most current on MapBuilder (Unlike you Baselayers which reflect even very recent changes on OpenStreetMaps. I'm a contributor there so i noticed that.). Cheers and keep up your great work.

    1. That's a good question I don't have an answer to yet. Because I'm only hanging on to data for North America, I'm not set up to take incremental update files - I need to spin up a new EC2 instance, get a full planet.osm dump, filter and import it, and then move the EBS volume over to the CalTopo server. I'm thinking it will start with quarterly, but I'm willing to adapt if that proves to be too infrequent - I have no idea how much trail data gets added/edited in a typical month.

      FYI, the OpenStreetMap layer goes directly to OSM's tileserver, which is why it has recent changes.

    2. I don't know how much data gets added/edited monthly on OSM either. Perhaps next time you update your server you can compare the files. I would hope you do this update at least once a month and then less frequently (i.e quarterly) if you see monthly is not worth your time. This Map Builder is an awesome feature that really sets you apart from your competition and having the most current data will make it even more valuable.

      Also perhaps on the menu where you select which trails to use you on Map Builder can add a "Last update xx/xx/xx" note. Cheers.

  2. The left/right/up/down movement function is broken as of 11/18. You can zoom in and out but the Google Earth style control is not there. Function from the keyboard is not working as well.

    1. I can still use my arrow keys to pan, but yes, the zoom control is collapsed into a small one. Hazard of using the Google Maps API is that it sometimes changes underfoot on you.

      I should get a fix deployed tonight, but enjoy it while you can - in another year, Google is axing support for the large pan/zoom control entirely and forcing everyone into just the +/- buttons. Might have to build my own control.

  3. The left/right...issue is on Firefox. The keyboard function works on Chrome. Did Google do this or what? I'm a little bent if they did and would like to see return of the original format for this function as it works across browsers.

  4. Guess I'm a little slow. I've not been able to understand exactly how to make this work. For instance, I've added a new layer I've called trails and configured it to show forest service trails but that layer totally blocks out the base layer. When I turn down the intensity of the "trail" layer so the base layer shows up, the trials get fainter and disappear along with everything else on the new "trail" layer.

    Is there a way to have only the trails show up on my new layer with everything else on that layer being transparent so the base layer could also show?

    What am I missing?

    1. CalTopo supports two types of map layers: base layers that show up in the dropdown at the top right, and overlay layers that show up as checkboxes, and generally have transparent backgrounds.

      Right now the MapBuilder feature is base layer only, although you can choose from a number of common sources, like aerial imagery, as the background. Adding a base/overlay checkbox is doable but not something I can fix with just a wave of the hand; I'll take a crack at adding it.

    2. In case this was the effect you were looking for, I've also added a "transparent" option to the base layer dropdown. Choosing this causes your MapBuilder layer to show up as a checkbox alongside the other mostly-transparent layers.

  5. This looks pretty bad ass so far..thanks Matt!

  6. First, thanks! I'm very new to using caltopo and I LOVE it! So I often select the MapBuilder overlay that has many trails that show up in red. These trails are often close to but don't always follow the base topo trails. Are they coming from OpenStreetMap? If so, are these GPS tracks that were taken? My point point is if I'm looking at a trail (or making a route) which is the most accurate to trace out? Thanks again!

    1. Yes, they are coming from OpenStreetMap (unless you have a pro subscription and create your own overlay layer, in which case there's a USFS option as well).

      OSM doesn't really have data quality standards. Some are GPS tracks, some are traced out over satellite imagery, and some may have been traced from a USGS topo.

      As a general rule of thumb, if both OSM and the USGS 7.5' topos show a trail, I'd expect the OSM routing to be more accurate.

    2. Thanks! That's about what I expected. The OSM seemed to be a bit more accurate than the USGS (where they differed) on a local hike I did this weekend.

  7. Matt, I only just found out about this, and it's great. (I'd tried CalTopo before, but where I hike, the USGS maps tell fairy tales about the trail routings).

    Like you, I wound up creating my own basemap. Just the other day, I added a layer at containing it, because I was trying to compare tracks with someone on the Northville-Placid Trail. We made different formatting decisions (what two people do that the same way, anyway?) but I think that we both have attractive and useful results.

    It would appear that we have found (or chosen) different data sources, and each of us appears to have information that the other doesn't. We should probably compare notes. Drop me a line (kevin dot b dot kenny at gmail dot com) if you're interested.

    Did you use NLCD for your landcover shading? Are you including any sort of wetlands data (I can't tell looking locally, because I hike in a coverage hold of the USFWS inventory - which I can help you to fill from New York State data, if you're interested). So many questions, so many things to learn...

    Anyway, great job!

  8. Hey Matt,

    I love the map builder topos you're making! any chance they'll be available for use on any smart phone gps apps like Gaia?


    1. Maybe, at some point.

      So far performance hasn't been quite what I'd been hoping for. A typical tile involves compositing three raster layers and two vector layers, as opposed to a standard OpenStreetMap style tile that is rendered in a single vector pass. Plus the NED-based contours are more detailed, and therefore computationally expensive, than contours based on SRTM or other worldwide elevation datasources.

      All of which is to say that I can't just open up the floodgates to Gaia, BCN and similar apps without building out my rendering infrastructure. This is as opposed to the USGS 7.5' and similar layers, which are pre-rendered and scale up pretty seamlessly on S3.

  9. I just recently discovered the Mapbuilder Topo layer and really like it. The only concern I have is that many, if not most major lake names are duplicated and thereby clutter up the image a bit. At least that's the case throughout the Uinta range of Utah. If that can be resolved, I'll be so much closer to becoming a paid user for the additional layer customizations and so forth. You have done a tremendously awesome job with this project!

  10. Hi,
    As I have aged, I have found that the screen on my Garmin Dakota is too small for me to read. I am looking for a solution, something with a larger screen, yet would be reasonable to carry on day hikes in the Sierra. I am wondering if something like a Samsung Tab S 8.4" would work as a solution? Could it be tethered to the Garmin, or would the Samsung's GPS would be sufficient? I would like to load a large 7.5 Topo, so to have a live readout for location. Could you offer some advice as to a possible solution? Thank you for any advice you might offer.

  11. this is great! I just found out mapbuilder layer in caltopo. i noticed that usgs layer doesn't accurately illustrate the water feature around Quantico VA, after trying out different layers, mapbuilder gives the most accurate info. I tried the mapbuilder map on my mobile device when i hiked Rock Creek Park in washington DC, trail information are mostly accurate.

  12. I'm curious where you are getting your placenames from. I maintain specialized maps from one area in Washington State and you have (correct) names for high points I have not seen on other maps. I thought it was ListsOfJohn at first, but you have some not in that fairly comprehensive database. And you have way more than OSM, which I help keep up-to-date for my chosen area.

    1. It's a mix of USGS data and data from (used w permission).