Thursday, May 3, 2012

Creating a bike map for Garmin devices based on OSM data

The end result: a cycle map in Basecamp
Update September 2012: A while ago, Henning suggested minor modifications to the commands in steps 2 and 6 that should improve performance.

I don't think I've written a plug for OpenStreetMap (OSM) on this blog yet, but in case you didn't know: OSM is an awesome project, and I'm a regular contributor to and user of their database.

In preparation for my ride to Toronto I wanted to create a bike map to put on my Garmin GPS. For many regions in Europe pre-made cycling maps for Garmin are available but you have to DIY. I had created a OSM-based cycling map before but it only covered an area of 200km around Montreal. Creating that map had not been without problems, and unfortunately in the meantime I forgot a lot of the steps necessary. Consequently, this time I'm going to document the process for myself and others. I've tried to keep the instructions as dummy-friendly as possible, not requiring any deep understanding of the processes and programs involved. Feel free to ask questions in the comments and I'll try to answer them.

Before we get started, I should send out props to OSM-contributor and bike tourer Henning Scholland/aighes. If you live in Europe you don't have to create your owns maps but just download the ones he created. He has also been very helpful in guiding me through the process of generating my first map. Now let's make a map.

Step 1: Download data

First you have to download the data of the desired region. In the ideal case somebody will already have prepared an extract for that region. If that's the case you can move to step 3. In Canada, however, it is tricky: on the one hand, you probably won't want a map of all Canada (I heard Canada is big and cycling in the Northern Territories is kinda lonesome); on the other hand you probably want to include some parts of the US. In order to achieve that you will have to create your own extract, either from the "planet," i.e. the entirety of all OSM data, or from the North America extract which has a more manageable download size of about 5GB.

Step 2: Determine the bounding box and extract data

Once you have downloaded the several gigabytes of data you will use the tool osmosis to extract the chunk of data that you want. That chunk is called the "bounding box", and it is basically a rectangle, defined by the coordinates of its four corners. 

Install and run Osmosis: Download Osmosis and extract it into a folder. Open the command line and navigate to that folder. Run Osmosis as follows:

osmosis --read-pbf file="c:\Users\Harald\Downloads\america_north.osm.pbf" --bounding-box left=-81.0131836 top=47.2195681 right=-69.8730469 bottom=42.5368920 cascadingRelations --write-pbf file=Northeast.osm

The read-pbf option tells osmosis what kind of input file it is dealing with. The file parameter is the map data file you downloaded in step 1. The easiest way for entering the correct  bounding box values is by using the export function on the openstreetmap.org slippy map: zoom to the desired area, click "Export," and copy the four coordinates you need (if you don't have quite the bounding box you want you can click "Select area manually" and then draw a rectangle). What cascadingRelations does I don't really know but it's probably good to include it. write-xml determines the output format and shouldn't be changed. The final file then determines where to the output will be written.

Extracting the bounding box for a large region can take a while and create big files (in my case it was 8GB for an area of 520 by 880 km).

Step 3: Split the tiles

For reasons that don't need to concern you the bounding box extract will now have to be split up into tiles before the actual map making begins. For that download the tool splitter and extract it to a folder.  Install and run splitter with the following parameters:

C:\Users\Harald\Desktop\splitter-r200\java -Xmx1500m -jar splitter.jar c:\Users\Harald\Desktop\osmosis-0.40.1\bin\Northeast.osm

Depending on how big your extract is and how much memory your machine has you will have to adjust the memory allocation with the Xmx parameter. Stated simply: you want to allocate as much memory as possible. If you try to allocate too much you'll get an error message and can adjust the value down. My system has 4GB RAM and I couldn't assign 2000M but 1500M worked. If you don't have enough memory assigned the splitting process will fail. Once again, the splitting will take a while (in my case about 10 minutes). The end result will be a whole bunch of .pbf files, a file called template.args, and one file called areas.list.

Step 4: Download boundaries

In order to have a functioning address search on your Garmin, you will need to integrate administrative boundaries while making the map (i.e. the boundaries of countries, states/provinces, municipalities). Download the file from here and unzip into the same directory as your tiles. (Please note that searching for addresses doesn't work all that well in Canada because of a lack of boundary data.)

Step 5: Download map style

If you want to use the style of the aighes's RadReiseKarte (bike touring map), download style.zip from his homepage and extract the contents of the data directory into the folder containing your map data. You should now install mkgmap. After the installation you can do a quick test of the style file: run mkgmap as follows (depending on where you put your files you have to modify the path to the style folder):

java -jar mkgmap.jar --style-file=data/style_rrk -- list-styles

This should produce an output of
The following styles are available:
style_rrk            1: No summary available


Step 6: Create the map with mkgmap

Now run the following, very long command from the directory containing your map data and the style directory:

java -Xmx1500m -jar mkgmap.jar --max-jobs=4 --read-config=data\style_rrk\options --code-page=1252 --mapname=66000000 --overview-mapname=66000000 --family-name="Cyclemap Northeast" --series-name="Cyclemap Northeast April 2012" --description="Cyclemap April 2012" --family-id=6600 --output-dir=maps\ 

Unless you know what you're doing (I certainly didn't when I was doing this myself) I don't recommend changing anything except for the series name and family name parameters and the path to the desired output directory. Once again, you'll have to wait a while until mkgmap finishes.

Step 7: Install map into Mapsource/Basecamp

Mkgmap can create IMG files which you can copy directly onto your Garmin device. In general, however, it's easier to install the map in Mapsource/Basecamp first. This requires you to download the NSIS installation system. Start the program, select the output-dir defined in the previous step, and voila: you have an installer for your new map.


This is what the map will look like in Basecamp at a higher zoom level (I couldn't get a good pic of the map on my Garmin Etrex).

Sunday, April 29, 2012

Ride report: CVRM Populaire April 28

I like long rides, and I like the idea of randonneuring: mostly non-competitive long-distance riding where your goal is to ride a certain distance within certain time limits. While still living in Ithaca, I never got around to doing a sanctioned brevet, partly because I wasn't quite sure if I could ride 200km or more, partly because none of the brevets start in or very close to Ithaca -- and I both don't like the idea of driving several hours to the start of ride and it's also not exactly practical if you don't have a car.

In Montreal, the practical aspect was much easier: all the rides start at the same place, only about 10km from our apartment. In terms of the physical aspect, I have also grown more confident in my abilities to be able to do at least a 200km ride -- after all, in 2010 I had done 230km on one occasion, and just two weeks ago I rode an average of 150km a day for 4 days in a row.

Thus, I decided to give to give the CVRM (Club Vélo Randonneurs de Montréal) rides a try. I was a bit intimated by the fact that their website is all in French whereas my French skills are still pretty limited. But whatever, last week I sent an email to the ride coordinator and signed up for their first Populaire of the year. Populaires are intended to introduce riders to randonneuring, primarily by being shorter than regular brevets which start at 200km. The ride on Saturday was announced to be 147km with a time limit of 10 hours.

I left the house around 8 o'clock and it was still around freezing. I had decided to do the ride on Wolfgang, my all-purpose, fully decked-out Cross-Check. As the forecast had predicted cold but dry conditions and the ride would be entirely during day light I might as well have ridden on the sporty Gunnar. After arriving at the start at 8:30 Wolfgang looked decidedly out of place: He was the only bike with fenders and dynohub lighting, and there were only a few other bikes with steel frames, racks, or non-system wheelsets. The rest was mostly racy crabon bikes, with a few titanium frames mixed in.

After a very cold half hour -- the icy wind was blowing relentlessly -- and a quick group photo, we finally got going with about 20 riders. And going we were! I tried hanging on with the guys in the front, and for the first 15km or so we were averaging well over 30 km/h. It was pretty obvious to me that this pace was absolutely unsustainable for me and I slowly fell back to what I think was the middle of the field. Supported by a strong tailwind I nonetheless kept my speed up and every once in a while saw some riders ahead of me. The first controle -- these are the waypoints where riders have to stop and get their brevet cards stamped -- was at a depanneur in the little village Saint-Paul-de-L'Île-Aux-Noix. There I caught up with a larger group of riders. Following Jan Heine's advice, I tried to limit my stopped time (the time limits on brevets count the total time, not only the moving time), and got going ahead of most of the rest of the group. Whereas most of the ride so far had been going south, i.e. in the same direction as the strong wind, the route now turned west or northwest, right into the wind. This slowed me down immensely, and I was quickly passed by the faster group. It would have been nice to ride in a group to better withstand the winds, but I knew that I wouldn't be strong enough to hang on with them. So I just continued on alone. At a long straightaway I got a glimpse of the group again -- and they were going straight where they should have turned right. The next controle was a gas station at km 95, and maybe 10 km before that the wrong-turn riders caught up with me and insisted that I ride with them. My legs weren't too excited but I went along anyway, channeling my inner Jens Voigt and telling the legs to shut up. Riding in a small group was clearly more effective in the wind and just before the controle we caught up with another small group (I guess they had taken the right turn).

According to the cue sheet, the second controle was a Shell gas station at the intersection of highways 219 and 221. I therefore was surprised and confused when the group left the Shell station on the right and stopped at PetroCanada 100 meters down the road. As a rule-abiding randonneur, I went over to the in my opinion correct gas station and met up with one other rider there. He wasn't quite sure what was going on with the others, too, speculating that they might be abandoning because of the wind. Well, we had a nice chat and decided to do the rest of the ride together. He had done a couple of rides with the CVRM before and he confirmed my impression of the club being somewhat more competitive than what I had randonneuring imagined to be.

Our abilities were fairly well-matched and while I in general don't mind riding alone, it was great to ride with him for the final 55 km. At some point we had to cross the A10 which added a little cyclocross element to our ride: the bridge was being rebuilt, with the surface at this point only consisting of the steel armaments without the final layer of concrete. A detour was not available and so carried our bikes across the narrow cantilevered pathway built for the construction workers. The rest of the ride was fairly uneventful, and at 3:50 pm, after 6 hours and 50 minutes, we checked in at the final controle.

At this point I was out of water, my legs were very tired, and my upper back and arms hurt. The final 10km back to our apartment I took it extremely slowly. This clearly had been the hardest ride I had done in a long time, surpassed probably only by my failed attempt of the "Terrible Hills involving the letter 'B'" in Ithaca and my ride up the Stelvio pass last summer.

Today, randonesia, the phenomenon that you very quickly forget about all the hardships a ride brings, has already started kicking in, and only my very sore legs are there to prevent me from immediately signing up for another brevet.

Sunday, April 1, 2012

Product review: Chain-L chain lube

The world of chain lubing and maintenance is one of strong convictions and fervent beliefs: to clean or not to clean? Wet lube or dry lube? Teflon or oil?

During the past couple of years I have almost exclusively used FinishLine Dry Teflon lubricant. My trusted LBS, Swan Cycles, recommended it--and more importantly: sold refills for cheap. The Finish Line lube is great in that it does not leave any dirt-attracting residue on the outside of the chain, therefore keeping it relatively clean. The downside is that it gets washed out pretty quickly, especially when riding in the rain or on wet roads. During winter this would often mean that my chain squeakingly demanded more lube after just a day. And since I'm a bad, bad bike owner, those demands often were ignored for several days...
Retrogrouch-friendly design


Consequently, the idea of a lube that withstands wet conditions without the constant need to re-lube seemed pretty attractive for riding in Montreal's winter. I first read about Chain-L on Kent's Bike Blog, whose writing I appreciate and whose bike-related opinions I trust. He was full of praise for Chain-L and commenters seemed to agree. On the Chain-L website there are also links to a bunch of very positive reviews from reputable sources. So when the accomplice went to visit some friends in Portland, I asked her to stop by at Clever Cycles and buy me a bottle of that wondrous fluid.

This is not chain lube (Image by Dvortygirl under a CC-BY-SA license)

Chain-L is sold in 4 ounce bottles (1 oz trial bottles are available, too) and it costs 12 dollars. This comes out to 10.14 for 100ml, compared to 6.76/100ml for FinishLine Dry or 8.74/100ml for Phil's Tenacious Oil. The lube resembles in color and texture Grade A maple syrup (translation for people from non-maple producing states: dark golden color and fairly thick). The instructions recommend to apply one drop per chain link, ideally on a new or thoroughly cleaned chain. After giving it at least 10 minutes to permeate into the chain and turning the cranks a couple of time you wipe of the excess from the outside of the chain. The stuff really is sticky and when you watch the chain running over the cassette you can see thin oily threads form between cogs and pulley wheels. The manufacturers warns you that due to its viscosity then drivetrain will attract a lot of gunk but I didn't find it as bad as I expected.

So what's my verdict?

Initially I was pretty disappointed. I applied Chain-L on Wolfgang, my all-purpose Cross-Check, some time in February, a time when there was still plenty of snow around and roads were wet constantly. Within just a few days my drivetrain started squeaking and surface rust was clearly visible. I reapplied the Chain-L, and this time around it lasted a little longer, but still nowhere near the hundreds or even thousands of kilometers that other people claimed. The next attempt with the lube was on the following Sunday: the weather was predicted to be lovely for March: 10°C and sunny, and so, after lubing up the chain in the morning, I set out for a 120km, 6 hour ride around half of Montreal Island. There were still plenty of snow heaps around, and thus a good deal of riding was on wet roads. Come next day's commute: squeak squeak squeak. So within just one ride all of the lube had gotten washed out again.

So what's going on? A) I'm doing something wrong. B) There's something about the environment that negatively affects my outcomes; or c) All the positive reviews for Chain-L are written by shills or people who don't know what they're talking about.

A) seems pretty unlikely, as there's not that much you can do wrong when applying chain lube. B) seems more likely. At least in the first weeks of me testing Chain-L there probably was still quite a bit of salt on the roads and it's possible that Chain-L and corrosive salt water don't go together well. I've kept using Chain-L since then and once roads switched from wet to dry and salt-free the lube did stay on longer, but still nowhere near the "1000 miles in the wet" some people have boasted.

Which leads me to C): As mentioned in the introduction, the world of chain lube is an esoteric one and has lots of strong believers and little hard evidence. I find I hard to believe (ha, there we go again!) that any lube will withstand 1000 miles in the wet on a bicycle. And anyone who claims otherwise is probably a little gullible or wants to sell me something. [edit: I must have been in a bad mood when I wrote this paragraph. Since it's already out there, I don't just want to delete it, but say that this doesn't add anything to the review and should have been left out in the first place. Apologies.]

Now this doesn't mean that Chain-L is necessarily a bad lube--in winter it clearly is superior to dry lubes. And who knows if, assuming I reapply it frequently enough, it will prolong the lifespan of my chains and cogs. But I'm very skeptical if it is superior to any other oil-based lubes.

The only comprehensive lab test of lubes I know was done in 2009 by German road bike magazine tour (free registration required for the download). However, performance in wet conditions was not tested. A really nice real-life test was done by Rainer Mai (German only; results table here) but nobody has replicated his results and there doesn't seem to be any systematic relationship between the type of lube and its performance.

So to sum up: in a world belief and convictions it's probably best to be an agnostic. For me, that means that on the commuter I'll use up the bottle of Chain-L (and keep reporting) and on the fair-weather Gunnar I'll stick with the FinishLine Dry. And once both bottles have been used up I'll try the next wonder lube.

Friday, March 30, 2012

Getting ready for Montreal--Toronto


The accomplice will go to a conference in Toronto mid-month, and I thought this would be a great opportunity for the first big cycling adventure of the year: riding from Montreal to Toronto. If I'm actually going to do it is not 100% certain: should the weather forecast predict high temperatures of less than 5°C and/or significant precipitation I will most probably cancel the trip. But that will be a last minute decision and until then I'll keep planning and dreaming. Here are the bare facts so far:

  • Route: I have it mostly worked out: follow the Route Verte 5 to the Quebec border, then follow the Waterfront Trail on the St. Lawrence and Lake Ontario into Toronto.  Still to do: figure out the best way to get out to York University.
  • Accommodation: Most campgrounds won't be open for the season yet and thus I will travel light and stay in the cheapest motels I can find. In some stretches of the route, for example Prince Edward County and around the Thousand Islands, that might not be that cheap after all but we'll see. 
  • Bike: Clearly Wolfgang, my trusty all-purpose Cross-Check. Were it summer, requiring much fewer clothing items, I might have done it on Gunnar, but for early spring Wolfgang is the better choice. He is in pretty good shape, with readjusted pedals and a new bottom bracket but there are still a few things I need to service, most importantly repacking the rear hub and changing the brake pads.
  • Return to Montreal: By train, hopefully in one of their bike trains.
  • Daily kilometrage: Total distance is about 650km and I plan on doing it in 6 days. The daily average thus is about 110km. I won't book any accommodation in advance and thus take the liberty to do less or more per day.
  • Food: Being a vegan, I'm a little worried about my food options en route. Ideally I'd cook myself but doesn't go well with credit card touring. But since it's only going to be 6 days I should be okay.

Friday, March 23, 2012

Ride report: Going west, to the Canal de Soulanges

One temperature record is following the other here in Montreal, and after my rather foggy Saturday ride, Sunday was forecast to be sunny and warm. Despite not having gotten much sleep, I decided to go for a long ride, getting to the mainland west of the Ile de Montreal for the first time this year. After taking the usual way west, along the Lachine Canal and then following Lakeshore/Bord du Lac to the western tip of the island. Then you cross the Rapides de Sainte-Anne next to the motorway and go across Ile Perrot on the fairly busy and unattractive Grand Boulevard/5e Avenue (a nicer alternative is to go around the island, but that adds a lot of distance). Another bridge next to A20 will take into Dorion where after half a kilometer of very dangerous contra-flow riding on the shoulder of the A20 you turn left onto Avenue Saint-Jean-Baptiste and then merge onto Route 338. Route 338, running mostly parallel to the A20 is not very busy and has a nicely paved shoulder all the way to the hamlet of Pointe-des-Cascades. Pointe-des-Cascades is the end point of the now derelict Canal de Soulange. According to Wikipedia, the canal was built as a replacement for the original Beauharnois Canal but became obsolete with the opening of the St. Lawrence seaway on the other shore of the river.

Canal de Soulange
Large parts of the Canal de Soulanges were still covered with ice

Route 338
Route 338: as straight as it gets
A very nice bike path is following the old canal on its entire length--something I didn't realize before already having ridden on the parallel Route 338 for a couple of kilometers. On this stretch, the nice paved shoulder was replaced by the typical Canadian unpaved shoulder, but as traffic remained light riding was very pleasant. Following the canal, the road is dead straight for many kilometers, interrupted only by a big construction site at the crossing with the future Autoroute de l'Acier.
Construction at the future A30
Building a southern bypass for Montreal
Having now realized that there was a bike path on the other side of the canal, I rode across a bridge and initially was very happy to find a nicely paved, wide path. However, happiness didn't last for more than a couple hundred meters, as in the shade there were still significant amounts of ice and snow on the path. the first few patches I precariously rode over, but it only got worse and I decided to turn around and continue on the 338. (Probably a wise decision, as on the way back I encountered a roadie who had just crashed on one of the icy patches).
Canal de Soulange bike path: here without snow
Not having eaten too much, I slowly started bonking and I decided to stop at the next little village, Coteau du Lac, have some food and then head back home.
Crackers and Pepsi: the lunch of champions
Having de-bonked and with the benefit of a slight tail wind I just glided back, first on the 338 and for the last part to Pointe-des-Cascades on the bike path.

Ceci n'est pas un dirt road. Just a bike path at the end of winter.
The rest of the ride was rather uneventful, but provided the opportunity for taking a bunch of nice snapshots:
Still a lot of ice on the river
Big ice sheets floating down the Rapides-de-Sainte-Anne



Contra-flow bike/ped lane on Bord-du-Lac
A final rest stop
Just before the sun set I arrived home, after 140km.

Wednesday, March 21, 2012

Ride report: going east, through the fog.

I haven't posted ride reports in a long time. One of the main reason is winter-related: in winter I find it too cumbersome to take pictures while going for a ride. Instead of just pulling the camera out of the back pocket of your jersey and snapping a shot while riding, you have to stop, take off your gloves, open the zipper, take the picture, stow away camera, put on gloves. And without pictures ride reports tend to be rather dull. Well, Montreal has been experiencing record temperatures of well over 20 degrees (and that's Celsius, not Fahrenheit!) and therefore I've been riding a lot and I've taken pictures.

Saturday started out somewhat bad: I had woken up at 5:30 but it was all foggy. The fog -- and the low temperatures -- didn't go away but at about 9 I got going anyway. After having ridden around the western half of the Ile de Montréal a couple of times now, this time I wanted to head out east. There is bike infrastructure going along the southern shore of the island all the way to its tip but from experience I knew that huge proportions of it are badly designed, badly maintained, or sometimes both. Therefore I took the easiest possible way: turn right onto Notre-Dame and keep going and going and going. Riding on Notre-Dame was alright, despite it being a major thoroughfare with up to 8 lanes. On a Saturday morning traffic was light and with one exception cars passed me with care.
Foggy Notre-Dame
The fog didn't only accumulate on my clothing but also on my glasses, making them mostly useless.
Near the tip of the island I then switched over to Sherbrooke and a bike path in reasonably good shape.

Once the path moved away from the road, however, it was still too snowy and icy to be usable. Therefore I followed Boulevard Gouin all the way to the point where I had to turn south to cut across the island into downtown. Before that, though, I came across the newly constructed path on the A25 bridge---which unfortunately was still closed.

After a quick stop to pick up a tool at ABC Cycles I then took a gratuitous detour up Mont Royal, now fully in the lovely spring sun. Total distance was about 70 km. Report from Sunday's ride will follow shortly.

Thursday, March 15, 2012

Broken Brooks B17: The Continuation

My Brooks is still broken, but there have been a few noteworthy developments. After posting about my plight on German radreise-forum.de and on this blog, I have received some useful feedback. A commenter here pointed out that Brooks has an "official" repair person in Philadelphia and that I should contact the US Brooks distributor, Highway Two, to get the repair shop's contact info. Unfortunately, they didn't reply to my email. I then contacted Brooks directly and within a couple of minutes they replied:
There is a man called Simon Firth who runs Hanford Cycles in Philadelphia who was trained here at the factory in Smethwick so he should be more than capable of repairing it for you. His email addresses are: hanfordcycles@gmail.com or brooksrepair1@gmail.com.
The second email address is no longer in use but after sending a message to Hanford Cycles I quickly got a response from Simon Firth. Repairing my B17 would cost 36 dollars for parts, 35 for labor and about 10 for shipping, totaling at 81 dollars. Plus the cost for me to ship the broken saddle to Philly and the ever-looming Canadian custom fees and taxes. Now I by no means think that these charges are too high (an online friend from Germany told me that he was quoted a total of 60 Euros for a repair directly at Brooks); however, I had bought the B17 for 90-something dollars shipped. So I don't think I'll have the saddle professionally fixed.

At the same time, I really don't want to throw out a piece that has served me so well and is in principle repairable. As a result I will attempt a repair myself. As mentioned before, Brooks sells all the necessary spare parts (i.e. the frame plus rivets) and their shipping charges to Canada are reasonable. Another online friend directed me at this very detailed how-to and the process seems to be doable. Some more advice and pictures can be found here. It's all in German but the pictures should be helpful. I'll order the spare parts soon and will report on the repair.

In the meantime, I have replaced the Brooks with the Velo Orange Model 1 and after the first 120km ride I'm pretty happy with it. But more on that in another post.