Thursday, April 24, 2014

Custom Map Layers

In the past, I've struggled with the balance between providing a wide range of map layers and keeping the layer list relevant for the majority of users.  The approach I originally adopted was to provide a large base list and a way to customize which layers were visible on the screen.

This turned out to be a bad idea all around.  It create a lot of work for me, most people never saw the customize link, and even those who did see it had no way of knowing if the list of available layers had changed.  Despite my best intentions, this was not the right way to expand CalTopo's support for regional or statewide map layers.

The almost-invisible layer customization link

The layer customization link is gone, as are some of the more obscure, little used map layers.  Instead, you can now add any tiled or WMS map source as a custom layer, and use it with almost all of CalTopo's features, including PDF generation and KMZ exports.  Start by clicking + Add New Layer in the left bar, and then Add Custom Source:

The two map types supported are tiled sources, which use Google Maps' tile pyramid structure popular with commercial map sources, and WMS, which is generally served up by government sites running some variation of ArcGIS.  The overlay property at the bottom of the dialog determines whether the layer shows up as a checkbox like the contour and fire history layers, or shows up in the standard layer dropdown with an opacity slider.

Max zoom applies to tiled layers only; many of these sources are supplied across a limited range of zoom levels (most of CalTopo's go to 16).  As long as this is set right, CalTopo will take over and automatically blow the source tiles up so you can keep zooming past this level.

This is all fairly advanced stuff.  For casual users, there's also a dropdown that auto-fills the form fields from a predefined layer list.  Currently this only has two options - the older USFS PBS maps and CalTopo's older Alaska-specific topo layer - but over time the list will grow to include datasources that don't meet the bar for inclusion in CalTopo's default list.

Beyond local and regional layers, I expect this will also include various federal government WMS datasources.


  1. I was trying to add OSM open cycle - Outdoors map layer through the custom source tool and was having issues with it. The source is from and I was trying to use the Outdoors map which is basically a modified layer of the cyclemap. Not sure if I was doing something wrong but I tried several different variations of the url and different subdomains and different settings but I could not get this to load properly. Any ideas? Or do you know if this map layer will be added as a default layer in the future? Thanks!

    1. I don't know if I'll add it as a default layer, since there isn't a ton of differentiation v. opencyclemap, some the rendering decisions are still visually distracting (e.g. patterned backgrounds) and frankly the OSM data is still not as useful as I'd like for backcountry purposes.

      Add it as a tile layer, zoom 18, with the following URL template:{Z}/{X}/{Y}.png

  2. Matt: was curious if you could help me to understand if I could import layers from the following interactive mapping tool link into Caltopo. It looks like it is using some variation of ARCGis so I assumed it would be the WMS method however I have no idea of how to find the URL similar to the example you provide in the custom source feature.

    The link is:

    was wondering if there is some backend way to get the layers into Caltopo.


    1. Looks like my previous reply got eaton, so sorry if this is a double. Fire up your browser's developer tools and look at the network tab as you pan around. You should see map tiles getting loaded, and it's generally easy to guess the URL template.

      In this case (and with the caveat that I don't know their policy on using their map layers with 3rd party viewers) the following URL worked for me:{tilesize}%2C{tilesize}&bbox={left},{bottom},{right},{top}

    2. Matt: Thank you so much... this is incredible.

    3. Matt: I do have one more question. Is there a way to get bing maps birds eye view as a custom layer? If not do you have any plans to possibly integrate this. I prefer these over the google sattelite views.

    4. I'm also trying to figure out how to load Bing aerial maps (the google one just switched to winter for my area, and I need summer). I found this URL but can't get it to work:[Q]?g=761&mkt=en-us
      any ideas? thanks

    5. Sorry, not sure how I missed Eric's earlier comment, but Bing aerials aren't an option at the moment, if for no other reason than licensing. I can't use them outside of the Bing map viewer, at least not without paying for them.

      Rachel & Nick, Bing map tiles use something called a quadkey, which is different from the standard Z/X/Y scheme. This is why it only has the [Q] parameter. At the moment I don't support quadkey based URLs, so there's no quick way to add them to CalTopo.

    6. Thanks Matt,
      Are there any other high res satellite image sources that you can recommend for Colorado? Love caltopo, just discovered it and am enjoying finding all the cool things one can do with it!

    7. Sorry; I can print from the US Topo imagery source, which works fine for 1:24k maps but doesn't have the same resolution for super detailed prints. I'm looking into commercial options that I can include as part of a paid service, but don't have anything at the moment.

    8. How do I upload

      I tried putting in the url but it doesn't seem to work.

  3. Matt,

    I'm also trying to do the same thing Eric H. asked about on May 8, 2015. I went to developer/network and got a URL, which now looks like:

    I selected WMS and put in the URL above and it shows repeat tiles of a small portion of the data on the layer. I'm sure you know what I'm doing wrong. Thoughts?

  4. I see that Steve S. was able to get it to work in his map:

    See his layer called DEC lands. I'm trying to do the same thing.

  5. Matt-

    This is a great feature!

    Does your interface support switch? EG

  6. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. Custom map