Auto Routing
While the freehand drawing tool helps, it’s never been easy to plan long-distance trail hikes using CalTopo. The only two ways to get realistic mileage estimates were to painstakingly trace over the map, or import someone else’s GPS tracks.
By piggybacking on the MapBuilder database, CalTopo now has an auto-routing feature. There are still a few quirks to work out, and at least until that happens, I’m leaving the feature off by default.
Start by creating a line, the same way as always:
Once you’re in drawing mode, there’s a new “snap to” option at the top right of the screen, next to the layer control:
As the names suggest, None turns the feature off, OSM uses OpenStreetMap data, and USFS uses Forest Service data. With auto-routing enabled, roads and trails show on the map as semi-transparent black lines:
To begin routing, click one of the segments (it will turn red when you mouse over):
Once you are snapped to a segment, mousing over additional segments will automatically create a routable line.
Mouse back out and you’ll see the traditional straight drawing tool:
Unlike typical routing tools that require you to specify start, end and mid points, this makes it easy to jump between trails and cross-country travel within the same route. Some of the known quirks at this point include:
- Roads and trails need to have a common vertex for the auto-router to recognize that they intersect, so some of the solutions it comes up with will not be optimal travel routes. Think of it as “auto drawing” rather than “auto routefinding”.
- Some OSM trailheads have small gaps between the road and the trail; the auto-router will not properly jump between these.
- For performance reasons, only 2000 lines are pulled back at once. At wide zoom levels, the road/trail network shown will probably be incomplete.
- Computations can lock up the browser for several seconds, especially when scrolling to a new coverage area. Clicking on the map during these lock-ups causes the auto-router to loose track of the line you were snapped to.
Accurate trail mileages are an issue that comes up constantly, and there’s no easy answer. However, I thought the JMT would be a good test case. In the summer of 2014, I had to plot a JMT route by modifying some PCT GPS tracks available online. This time I was able to trace it out in a couple minutes using the auto-routing tool; the slowest part was making sure I stayed on the JMT proper rather than a nearby variation.
![]() |
routing mid-trail |
The CalTopo-drawn line was 210 miles to Whitney Portal, vs the official number of 221. So about 5% short, which doesn’t seen too bad.
This is very handy. Most of my local trails are forest service so this makes route planning quick and easy.
Thanks!
Thanks for adding this feature. Excellent.
Nice feature, easy to use- thanks Matt!
I was looking for this for a long time! Thank you for doing this. One thing: I noticed that Caltopo usually calculates the mileage incorrectly, as you noted above. I find that I usually have to add a couple of miles to get a more accurate number.
Tracing along a map will never perfectly match real life. Unfortunately there isn't a single correction factor I can add in, as the error varies depending on whether the route was hand-traced or a GPS track, how windy the trail is, on vs off trail travel, etc.
Hey Matt, thank you for all of your work on this and this feature is very helpful. My question is whether the mileage estimate takes into account the mileage increase due to elevation changes or if it is measuring the distance as if you were on flat ground? Thanks!
I responded where you asked the question on Andrew Skurka's blog (http://andrewskurka.com/2015/the-future-of-caltopo-interview-with-founder-matt-jacobs/); it's currently awaiting moderation.
Thank you Matt! I did not know if you would be notified of that so I continued searching on how to reach out. Thank you again for your work on this project. Have a great day!
This is great! I don't know what I'm going to do with all my spare time saved from tracing trails. Nice work as always, still recommending to friends and family.
Hey Matt! I just discovered this gem of a website and I love it already. Currently I am situated in the Italian Piemontes and I would like to know if I can snap my routes as well. It does give an option to snap to OSM, but no dark lines show up. Does OSM Europe not provide enough data for this function? I would love to make use of it.
Autorouting is based off the same database as MapBuilder, and since MapBuilder is limited to the US, I limit the OSM dataset rather than pulling in a full copy. This isn't the first time the issues has come up, and when I do the next MapBuilder OSM import in a month or two, I'll probably import the whole thing rather than cropping it, which would give worldwide auto routing support.
That would be very awesome. Let me know!
Hi Matt, Thank you for your efforts on this website.
I just discovered the auto-routing option but I must be doing something wrong.
I add 'line' and enable snapto to USFS.
When I mouse over a trail segment with the hand icon the segment turns red.
When I left-mouse-click to "click one of the segments" it goes into "traditional straight line drawing tool".
It's clearly operator error on my part since it works for everyone else. Any hints or extremely specific instructions welcome as I really could use this.
Thanks!
At the bottom of the config menu (which is along the top of the screen), set size to large. I need to make this the default; most people who have an issue with auto-routing are accidentally nudging the mouse slightly while clicking, and not actually landing on the highlighted line. I think some mouse/trackpad hardware makes this worse than others.
If that doesn't work, let me know.
This comment has been removed by the author.
Hey Matt! Is the next import of the MapBuilder OSM coming up? I hope you haven't forgot the feature request for Europe too.
Soon.
My priorities have been getting CalTopo Offline launched (done) due to the number of requests I was getting for offline data and launching an alternative to the Garmin Communicator Plugin (close) which has been another sticking point.
I have only noticed now there is worldwide auto routing support. You are a hero!
Hey Matt!
Been really enjoying the new Caltopo app – I think its going to be replacing the BCN XE app for me!
Features I need in a GPS app: Offline maps, import/export GPX, route creating, Topo maps/contour overlays, view location elevation, and draw polyline and see distance and elevation profile. Caltopo nails it with all of these!
Question I have right now in regards to your article – is the auto-routing feature available in the Caltopo app as well? Would be great to be able to create routes like that in app, vs polyline routes. But would be totally understandable if the processing would be too heavy for a mobile phone to handle
So I just saw this. So sorry to not be more timely. I think you’re referring to snap-to lines, its something we would like to add but it’ll be down the road a little way for sure to get it engineered in a functional way for mobile.