Wednesday, December 12, 2012

Mapmaking 101

I am totally caught up in a new passion, map making. I suppose I shouldn't say map making — it's more like map contributing, but whatever you call it I'm having great fun. I'm so preoccupied I can barely keep up with emails and haven't looked at Facebook for days it seems. It does take a lot of time to do this right but I happen to have a lot of time to spare — it's the perfect pastime for a geeky map lover like me.

I've written before about my penchant for making GPS traces of my travels. Since buying a Garmin GPS receiver a few years ago I've recorded tracks for every trip I've made, every hike, every motorcycle and bicycle ride, every walk in Europe, Fiji, Africa and S.E. Asia. A "track" is basically a recording made by your GPS of your position, expressed as latitude and longitude coordinates, at a certain time. A series of these time/position values represent a "track" or path on the earth's surface.

If you think about what the GPS is doing, how much serious data processing is taking place while walking or riding along, it is a truly an astounding piece of equipment. It's receiving precisely timed signals from anywhere from four to maybe twelve satellites, each of which are constantly transmitting their local time, a time derived from an onboard atomic clock, and precise location in space from which the GPS makes navigational calculations in order to determine a lat/lon position on the earth's surface. It then records the calculated positions and times in its memory. It's also simultaneously doing a host of other things like displaying the track on a continuously updating color map, calculating and displaying speed, ETAs, course, altitude and many other parameters.

Here's a sample track from a bike ride to Red Mountain across the bay from Homer. We were going uphill so the total time involved was 2 hr, 17 minutes and my GPS recorded 419 points on the 8.9 mile long ride. A typical downhill return takes about 45 minutes. Also visible is the track of our boat trip from Homer Harbor to Jakolof Bay.

Red Mountain Bike Ride (GPS track in green)

With the use of some software from Garmin, (Garmin Basecamp, a free download) they are displayed on a topographic map of Alaska. They can also be displayed beautifully in Google Earth or in Google Maps. You can see that my track, which follows the actual Jakolof Bay Road, reveals a disparity in the location and shape of the roads as the map represents them. This is one sort of thing I'm working to correct. Don't get me wrong. You can buy very accurate maps for almost any country on earth for around $100 bucks a pop but the world wide map I'm working on is put together and maintained by volunteers, exactly the way Wikipedia works, and it's free to anyone who wants it.

The Alaska topo map you see above is also free and probably took its roads data from the old Tiger line files produced by the U.S. government years ago. TIGER/Line files are digital files and contain geographic features, such as roads, railroads, rivers, and while better than nothing they provide only a very rough approximation of the actual road shape. The topographical data is in the public domain and is available from the U.S. Geological Survey, the makers of the high quality U.S. topo maps many of you are familiar with.

(Free topo maps for much of the U.S. available here.)

The road maps I've been using in Thailand are produced by the Open Street Map Foundation, (OSM) a non-profit group of volunteer mappers and programmers located all over the world. They are completely free and because the street data are quite comprehensive they can be used in GPS units that do auto-routing. With an auto-routing GPS you merely enter a destination into the unit and then command it to "Go there". Its internal software will make decisions based on data in the maps (such as one-way streets, road segment lengths, speed limits, etc.), to create a complete route, a turn-by-turn dialog that plays as you follow it. Some units can further assist the driver with spoken directions in either a male or female voice.

(Free auto-routing Garmin Maps available here.)

I only recently learned that anybody can upload their GPS tracks to the  OSM map database. I did that never thinking those tracks would end up "in print" so to speak. But lo and behold, I downloaded an update to the Thailand maps I've been using and to my complete amazement, there were the roads I added! I was thrilled to say the least. I can make contributions to a map that is free to download, learn about auto-routing GPS maps, and then share my efforts with the rest of the world. It's totally awesome. I've added tons of streets in my Chiang Mai neighborhood, some roads over in Udon where I was last week and now I'm doing the area around Homer. Apparently no OSM volunteer has decided to fix up the map of the Homer area yet. Until now.

To explain how I got started with this, Nut and I wanted to drive around the other side of Lake Phayao on the bike while we were visiting the area a couple of years ago. I wrote about it here: Lake Phayao. It was a beautiful ride we had to scope out on our own because none of the roads we used were on the OSM map I had on my GPS at the time. We had been to the west side of the lake but only by a lucky accident. I wanted to find a better way. Using Google Earth I located a small road on the north side of the lake that connected with the west side roads I wanted to travel and with a highway that existed in the version of the OSM map I was using at the time. I set up a waypoint in my GPS and we drove there on the Phantom to make our start. Here's a screen shot of the Lake Phayao map as it looked in 2010. We followed a series of small unnamed lanes that hugged the shoreline until we got to the big highway bordering the lake on its southern side. Then we turned around and did it again.

I uploaded the tracks from my GPS and with the help of aerial imagery available on the OSM Map Editing interface, added the roads we had explored. Here's the map as it looks now.

When "my roads" first appeared on the downloaded maps, I cannot tell you how thrilled I was. I've always loved maps and have spent hours, days, months, staring at topo maps, road maps, any map I could get my hands on. Back in the 60s a friend owned the entire set of topographic maps for Cape Cod, something like 30 big maps. I inherited them when he moved to California and when tacked up on my bedroom wall they took up the entire thing, floor to ceiling. I still have a roll of Homer topos stashed in Homer but since the advent of Google Earth I never look at them.

I had often wondered how I could break into cartography but the learning curve for real map making, the background one would need in spherical geometry, the understanding of projections and datums, etc., was enough to put me off.  But with the OSM Editor, Potlatch, with a backdrop of Bing aerial imagery  it's relatively easy to add roads, rivers, even sophisticated things like freeway interchanges to the OSM road map of the world.

In the screen shot of the OSM representation of the nearby Rte 1369 and Rte  1001 interchange that I worked on you see roads/lanes in yellow (OSM calls them ways), with arrows to depict one-way lanes, the background of Bing aerial imagery, and the red dots that represent "nodes" in OSM parlance. In the photo one of the ramps has been "selected" by clicking it with the mouse thus rendering the nodes visible. There are similar nodes in the other ways but you can't see them because they're not selected. When selected any node can be moved with the mouse to align the roadways, make junctions, smooth the curves, etc. Double-clicking any node starts a new way from that point or allows extending an existing way. There is much more to map editing but that covers the very basics.

Junction of Thailand Routes 1369 and 1001 shown with Bing aerial imagery as background
When I started working on this interchange it was shown on the OSM map simply and incorrectly as two 2-lane roads intersecting at a traffic signal. The reality is as you see above. It does consist of two 2-lane roads but they don't actually intersect. For starters both roads are divided highways. Route 1001 crosses 1369 on a bridge and there are entrance and exit lanes to limit and control access in typical freeway style. I tweaked and fiddled, then tweaked some more to obtain the result you see above. If coming from the east on 1369 and wanting to go to the Rim Ping Market the GPS will now correctly tell you to proceed west until you can make a U-turn and then come back to the market (Note: in Thailand you drive on the left) whereas before it would have told you to make a right turn at the light, an impossible maneuver because no intersection exists — 1369 is underneath 1001 at that point.

Below is a screen shot of the roads at the end of East End Road in Homer as they exist in the OSM database at present. The roads are shown as they appear in the OSM editing window and are overlayed atop Bing imagery which shows a bird's eye view, taken from satellite photos, of the area. You can see that the Tiger line files they're based on are practically worthless as representations of the actual roads. However they are a starting point and generally provide correct road names that are not copyright protected.
I love that area at the end of the road. It's special because I lived there during my first years in Homer, years before Vosnesenka and Razdolna existed, and because my son Tuli was born out beyond road's end on the Rainwater homestead in 1984.  It's going to take a ton of effort to fix things up but I'm happily working away on doing the entire extent of East End Road and when I've got it finished I'll write it up. My other projects include Seldovia, the Red Mountain area and the Rocky River Road, Oilwell Road in Ninilchik, Diamond Ridge area roads and trails — all favorite haunts of mine. And then there's Thailand and Chiang Mai with its warren of small lanes, many unnamed and unmapped. Lots to do.

OSM map of East End Road and environs, November 2012
But I'm having a ball doing this. Life is good. I'm healthy and I'm busy — making maps, doing field work with my GPS on the streets in my neighborhood, playing the best tennis of my life, enjoying living in the Land of Smiles and hanging with my sweet gal. Who could want more?