Google Maps on your Nikon camera

Have you ever took a picture of a map while travelling, so you can consult it later on your camera? Yes, me too. THe problem is that you still have to find the proper map while on the road. How cool would it be to be able to store some Google maps (etc...) on your Nikon camera? Well, you can! It may not be as easy to use as a smartphone but it works everywhere, even when the network is down. This can be a deal breaker for people who travel far from populated areas.

Here's how to do it, at least with the Nikon cameras that I own. It likely works with other brands or models with some modifications.

  1. Use Google Earth or some other software to get the maps.
  2. You should choose a scale that fits your needs; this will likely depend on the area you want to cover and the resolution of your camera. On a D3x, I use an altitude of 200~300m. To prevent distorsions when stitching the different pictures together, disable the terrain rendering. To avoid zooming and rotating, use only the keyboard cursors to move the map around once your altitude and orientations are set.
  3. Pick some feature as reference, place it on the edge of the viewed area, then make a screenshots ("Print Screen" key in Linux Ubuntu)
  4. Move the viewed area to the next one with a little overlap, using your reference feature. Repeat until you have a complete set of (slightly) overlapping screenshots.
  5. Collected screenshots can be stitched with a program such as Gimp; you'll be surprised at the consistency of even individual pixels in your overlap zone. For each D3x picture, I have 9 screenshots to stitch (3x3 matrix). The size of the stiched image canevas should be exactly the same as the JPEGs produced by your camera (JPEGs and RAW sizes may differ!). Due to the orientation of your camera LCD, picking a landscape orientation is probably a good idea. Here's an example of stiched image on which I also added some bright red annotations (the area is Tofuku-ji in Kyoto).

    Stitched image

    And another example of a cleaner 3x3 screenshot stitch:

    A cleaner stitched image

    Maybe this looks low resolution, but it is in fact a 24MP image. A 100% crop will show you this map is in fact perfectly usable. You're of course free to pick your map resolution.

    100% crop

  6. Once the stitched picture is built, you can add annotations. Don't write too small, otherwise you will only see them when zooming a lot.
  7. Capture and stitching is relatively painless and easy to understand. But here come the tricky bits: saving your images! You need to use a specific JPEG format: 4:2:2 subsampling, integer DCT. Wasn't easy to find that setup! Luckiky, your camera will give you some hints, such as "Image contains no data" (the camera can't read the JPEG image). With Gimp, go in the advanced settings when you save the file, and be sure to select the 4:2:2 mode:

    Saving in 4:2:2

  8. Most image editors will modify the EXIF data, even very slightly (e.g. modification date). Nikon cameras don't like modified exifs. So to fool your camera into thinking your JPEG is a proper photo you'll need to copy exactly the EXIF data from one of your pictures. Choose one that is in the same orientation as your map (landscape/portrait). An exact copy of the EXIF is not as easy to do as it seems, and only one program that I've tried could do it: jhead (apt-get install jhead). Here's the command line:
    jhead -te real_photo.jpg stitched.jpg
    This will copy the EXIF from one of your previously taken pictures (real_photo.jpg) into the stitched image.
  9. And voila! That's it! The image should now be recognized by your camera, and you will be able to zoom in/out and scroll your "map". If your camera tells you "Not an image file" it means the EXIF is corrupted in some way.

This hack is very useful for me; I have even gathered the complete coverage of the city of Kyoto where I shoot a lot. It does, however, have a few drawbacks:

  • You can't update your map easily. You can't add/remove overlays. This is a low-tech raster data hack!
  • Taking screenshots and stitching them is annoying (expecially for a whole city ;-)
  • The EXIF of your original picture contains a JPEG thumbnail that is used when fast-browsing shots on your camera and PC. So you will always see the picture of your original shot when browsing! However, after a second ot two the real image is sampled and shown by the camera (at least in the browsing mode that shows the largest picture). I would really like to be able to customize this thumbnail, for example with a big map number (e.g. F-4, B-7) or some other information. But at this time I haven't been able to modify it. Help is welcome!

Last word: this hack is not limited to maps. Any information you want can be put in the jpeg: backup phone numbers, sunrise/sunset tables, hyperfocal distances tables, etc etc...