2010-02-14

Geo-Referencing PDF Maps

Geo-referencing an image is easy these days. Google Earth can do it for you with a few clicks. Basically, all you have to do is centre Google Earth approximately where your image is, import said image as an Image Overlay (Add - Image Overlay), and then fuss around until the image lines up with the underlying data.

Of course, there are a few tricks... like setting the transparency of your image down so you can see the background through it. Also, it can be a little frustrating getting everything to line up, what with getting the scale, rotation, and position all correct at the same time. But, with practice, it goes quick.

However, what usually happens is that you've downloaded some park map in PDF format and Google Earth won't take PDFs as input for an Image Overlay. You have to convert first. So, here's how to convert. Actually, here's a couple of ways to convert:

The complete-tool approach: Download and install the GIMP (GNU Image Manipulation Program) from HERE. It's a great Open-Source (free) application like Photoshop, but better (because it's FREE - which always makes it better). Once the GIMP is running, simply Open the PDF file, which brings up the PDF import dialog. There, set your resolution (more on this later). Also, if it's a multi-page PDF then choose to save each page as a separate image. Then, after the GIMP is finished importing, all you need to do is save your image(s) in whatever format you prefer to work in, png, jpg, whatever you're comfortable with.

The "you've probably already got these installed" tools approach: Here, when you open the PDF in Adobe Acrobat Reader, set your zoom to see the whole of the map you want to grab. Then, use the Snapshot Tool (Tools - Select and Zoom, Snapshot Tool) to highlight the map you want. Now, it's likely to pop up and say "Copied" but we don't care about that. Instead, start zooming in by hitting the zoom button until you get the resolution you want. Then, copy it (Edit - Copy). The next part is to get the image out of the clipboard. Here, you need to start the graphics program you normally use. If you don't have one, you can either install the GIMP (in which case you're might as well just open the PDF directly) or, if the GIMP is a little too intimidating (all that power comes with a price), you can try Paint.Net, available HERE. Paint.Net is reasonably powerful, very easy to use, really snazzy looking, and, of course, free. Paint.Net has a command to Paste in to New Image (under Edit) and then you can save in whatever format you want to work in.

Okay, now back to that "resolution" thing. At first you might think that 100% is about optimum, but it really depends on the PDF you're starting with. The nice thing about PDFs is that they may have True-Type fonts and vector tracks over-top a raster image (more on Raster verses Vector HERE, if you really care). This means that the lettering and routes still looks clean no matter how much you zoom in, even if the background image starts to pixelate (get blocky). If you have this kind of PDF, then it's a good idea to over-zoom the resolution before converting to an image. That way, you can still have crisp text and routes when zooming into the image later on. 200% or even 400% is not unreasonable. If, however, the PDF is only a raster image, then there's not much point in going past 100%. It will just make for a larger image without any advantage.

Once you have the image overlay properly referenced in Google Earth, you can trace out the points and tracks you're interested in, then save those in KML format, then convert via gpsbabel to whatever other format you happen to use (GPX is a good bet for importing into other applications), and you're done.

PDF to Image to Google Earth to KML to GPX to whatever you want... Power to the people.