Tutorial: Geotagging and Mapping Photos
One of the best ways to take advantage of the possibilities of multimedia is to include a map with your story. The use of maps have found multiple applications, from real estate to travel, even plotting sites where crime occurs.
Geotagging, or geocoding, is the process of tagging photographs with location data in order to display them on a map. It is increasingly popular as free online mapping tools become more sophisticated.
Here, we will introduce you to a Mac-based workflow for correctly embedding multiple photos in online maps. Working on a Windows computer follows the same workflow, the major difference is the use of which software package used for geotagging the photos.
In this lesson, our goal is to take a walk, shoot some photos, and use a GPS device to keep track of the path. With that data, we will then use a geotagging program to match the photos with their location. And with that information, we will map the photos online. Although the procedure may seem complex, the individual steps are quite straightforward.
This tutorial relies on two pieces of hardware:
1) A digital camera. Any camera that records the time the image is shot will do.
2) A GPS tracking device. The general workflow outlined in this tutorial will work for any GPS tracking device. Details, such as the output file format of the device, can vary, so be sure to consult any accompanying manuals. But the principles of geocoding photos and uploading them are essentially the same. For our purposes, we are using the GARMIN eTrex Vista HCx personal navigator:
The GARMIN device comes with an owner’s manual. You can also download one at the product web page.
The primary software we are using is a Mac-only program called HoudahGeo. It can be downloaded online, though is somewhat costly at 25 euros. There are other programs that may yield similar results, but this is a popular geocoding softare choice for Macs. We will also employ an FTP program to upload photos to a web server, Excel to aggregate the data for the map, and an online service called ZeeMaps to map location data online
*If you are using a PC, we have heard good things about the geomapping program RoboGeo. And if you have an iPhone, you may be able to use an application like Trails to turn your iPhone into a GPS tracker.
Using the GPS Device
Getting to know the GARMIN GPS personal navigator
The GARMIN GPS device is quite small, about the size of the rapidly obsolescing cell phone seen below.
We chose this model because it is relatively inexpensive, is easy to use, and if you are using a Mac, the device behaves like any other drag-and-drop USB storage device when connected via USB cord. One drawback is that firmware upgrades are only available using a PC.
It uses two AAA batteries. Be sure to load those batteries before use. To load the batteries, turn the GPS over.
Then twist the metal loop on the backside of the GPS counter-clockwise. Lift the back off. After you’ve loaded the batteries, place the back on again, and turn the metal loop clockwise until you hear a click.
There are six buttons on the device.
The Power and Quit/Page keys on the right side of the device:
Press and hold the power button to turn the power on and off. Press the button with an “X” on it, the quit/page key, to cycle through pages once you have the GPS powered on. You can also press and hold the quit/page key to turn the compass on and off.
And you’ll see the Zoom and Menu/Find keys on the left side of the device:
Push down the two arrow zoom keys to maximize or minimize your map, or to scroll up or down a list. Press and release the menu/find key (with the notebook icon) to view the “Options Menu” for a page, or press and hold the menu/find key to display the “Find Menu.”
You’ll also see the Enter/Rocker key on the front of the GPS device, to the left of the eTrex logo:
The enter/rocker key is like a joystick, and by pressing in and releasing it, you can move through lists; highlight fields, buttons or icons; enter data; or move the map panning arrow. Press in and hold this key to mark a location as a waypoint. For the purposes of our project, we won’t need to keep track of waypoints.
Using the Device
Press and hold the power button to turn it on.
The GPS will take a second to acquire satellites. When the screen shows a map of where you are, that means it has established a link. If for some reason the map isn’t showing up right away, try powering the device on and off, or try a fresh set of batteries. In other GPS devices, we have found that after using the device for several hours spread out over a few days, we had to change the batteries even though the battery icon did not begin flashing. A full day’s use may be enough to drain the battery. Rechargeable batteries may be a good investment if you plan to use the device often.
Collecting Photos and Location Data
To begin, make sure that you are familiar with the digital camera you plan to use, that its battery has enough charge, and your memory card has enough space. It is also important to make sure that the clock on your camera is properly set. Before leaving, check the camera’s clock against an accurate clock (such as the one on your computer, if it pulls time data from the internet) or http://www.time.gov. We also recommend that you take a photo of the clock on the GPS device so you know when your first photo was taken. (The time that the camera embeds in each photo will later be matched up with your GPS data, and it’s useful to know.) We’ll show you how to do that next.
When you’ve arrived at the location you’d like to work at, turn on the GPS device by pressing the power button on the side and hold the unit facing the sky. (If you haven’t used the device, or it has been a long time since you’ve used it, you might want to turn it on earlier in case it takes time to find and establish a satellite link. Once it’s established a link, you can turn it off until you want to begin.)
Once it has acquired satellites, press the menu/find key on the left of the device twice until you reach the main menu. Then, use the joystick enter/rocker key to scroll down to the Setup icon. Click the joystick once on top of that icon and you’ll be at the setup menu. Use the joystick to scroll over to the Time icon and click on it. Now, take a picture of the GPS device screen, being sure the time is readable in the photo. After you’ve done that, return to the map by hitting the quit/page key on the right side of the device.
Then, begin walking or driving along your chosen path, taking photos along the way. With the attached cord, you can wear the device around your neck, freeing up your hands.
When you are done, simply press and hold the power button on the GPS to turn it off.
Downloading Photos and Geodata
Download the Photos
We recommend downloading your photos from the camera into a permanent project folder rather than a temporary location, since the the GeoHouda program does not copy the images into a new folder. Crop, resize and color correct your photos at this time. If you are shooting RAW or DNG save a final version in JPG or PNG format into a new folder. You can do as much or as little processing and organizing with your images as you like.
The key, though, is to retain the EXIF data–the metadata embedded in each image file–particularly the time it was shot.
Transfer the Geodata
To retrieve the file of GPS data from your walk, connect the GPS device to the computer using the accompanying USB wire. On the back side of the device, insert the small end into the device’s USB slot, which is protected by a rubber flap; insert the other end into an available USB port on your computer.
If you’ve used the device before on your computer, the device will appear as another drive on your computer called “GPS Tracker”. Your GPS track log file will appear in the folder “gpsfiles” on the drive. If it’s your first time using the device, you will have to select it after you upload photos (see the next step).
The year, month, and day will be part of the file’s title:
Drag and drop the log file into your project folder.
Please note: Remember that every time the device is turned on, a brand new GPS log file is created. If you turned the device on and off while on the trail, or if you had to change batteries and restart the device, their will be an additional log file. In that case, you will need to download each file to your computer, and later you will need to import each file into the geocoding software. To reduce confusion, consider deleting log files from the device regularly (simply drag the files to the Trash when connected to a computer).
Matching Photos with Geodata
Open HoudahGeo. If the program is not on your dock, then it will be in the Applications folder.
HoudahGeo links photos and GPS data by matching the time on the photo with the GPS point with the closest timestamp.
The HoudahGeo window is divided into three sections:
- Import photos
- Add geodata
- Export geocoded images
In the first step, you can pull in photos from iPhoto, Aperture, or Adobe Lightroom by pushing the “Add Image from Library” button (1). You can also browse through your folders by choosing the “Add Images from Files” button (2).
There is a third, faster option: simply select and drag the files directly into the program.
When adding photos, you will be asked what time zone you took the photos in; choose the appropriate time zone.
In the “Clock error” field, write in the precise number of seconds that your camera’s clock is out of sync with the GPS device. The best way we’ve found to figure out the time delay is to compare the time stamp on the first photo you took with the GPS device clock that appears in your first photo, assuming you took a picture of the GPS clock before you started. Enter the positive or negative time change and click OK.
Once you’ve added your photos, HoudahGeo will automatically send you to the Import Geodata step. At this point, each of the photos is listed in the window in red text. This indicates that the photos have not been geotagged. When successfully tagged, they will appear as black text.
You can save your project (press Command-S) at this, or any, point.
There are four buttons in the geodata step.
1. “Load GPS from Device.” This is what we will use. When the pop-up window comes up, choose the Garmin, the USB port and click OK. We’ve outlined what the other buttons do as well, even though you won’t need to use them.
2. “Download GPS data from a file.” If you’re using other GPS devices, you can browse to your log file.
3. “Manual geocode.” Manually locate your photo using a map. This can be somewhat time-consuming. We will not need to do this because we have the tracking info.
4. “Geocode selection using Google Earth.” Also a cumbersome process. The program will open the Google Earth application (if you have it installed on your computer) and you will have to locate each point manually.
After clicking the first button, choosing your GPS device and clicking OK, HoudahGeo will match the images with the GPS data. This may take a couple of minutes, and a progress bar will be visible as it works. The location data will appear in the window next to each photo.
As you can see, the geodata has been matched to each photo, and every entry is now in black text, not red as it was previously.
If nothing happens and you don’t see location data, double-check that you input the correct time zone. This may happen if you did not properly set the time on your camera, or if you traveled to a different time zone and the GPS, for some reason, still recorded in the last time zone you were in. In that case, you would have to match the camera time zone to the previous time zone you were in. You can change the time zone by going to the top menu and choosing Image: Camera Setup…
Since we have this geotagged photo information, we will soon leave HoudahGeo.
Now you have a few options. The most useful one moves beyond HoudahGeo to create a file that can be uploaded to ZeeMaps. To learn more, please skip to the next step of this tutorial, on uploading photos to a web server.
If you want to use HoudahGeo to work with the geotagged data, your options are limited to these three buttons:
1. Writing the geodata back to each photograph’s metadata. This may be useful later if you send the photos to someone else or open it in certain programs because the geodata is embedded in the file itself.
2. Creating a Google Earth compatible file. The advantage of this option is that the actual path you followed, as recorded by the GPS device, will be displayed. One disadvantage is that it can only be viewed in Google Earth–you can’t embed this in a blog or web page. You can create either a KMZ file, which is self-contained, or a KML file, which must be properly linked to photos on a web server. (Please note the KMZ only displays properly on Google Earth version 4.2. If you are using the newer Google Earth v. 4.3 beta, only one photo will be visible.)
3. Uploading the geocoded files to Flickr. If you use this option, please ensure that your Flickr Privacy Settings are set to import EXIF location data, so the geodata is properly interpreted.
Upload Photos to a Web Server
In order to incorporate the photos into an online map, the photos must live on the web somewhere. You’ll want to make sure your image files are accessible through a web browser before attempting to make a map out of them.
In most cases, you will need an FTP program and permission to upload files to a web site. If you do not normally upload material directly into your web account, ask your administrator for assistance.
If you’re working at UC Berkeley’s Graduate School of Journalism, skip the FTP instructions here and see the Special instructions for Knight Workshop participants (below) instead.
Access your FTP account and create a directory for the photos, such as a folder named “photowalk” in the “photos” section of your web site. The resulting URL may look something like this: http://mysite.com/photos/photowalk/ . This is the online path to your image files.
Upload your photos. Once the upload is complete, test the URL of one of the photos to make sure they are visible online. For example, if you uploaded an image file named “image1.jpg,” the resulting URL might look something like:
When you input that address in your browser, image1.jpg should appear in the browser window.
The next step is to create a spreadsheet of data that includes links to these image files.
Special instructions for Knight Workshop participants
Due to the setup of the journalism school’s network, you don’t need to upload your photos through an FTP program.
Instead, open a Finder window and select the “Home” icon in the left-hand column. In the example below, that folder is “student2.” Then navigate to your Sites folder. Now you can drag your folder of photos somewhere within the Sites folder. (Or, you can create a new folder and drag only selected photos into it.) Be sure this new folder has no spaces in its name, since this name will be incorporated into the URL and spaces are problematic in URLs.
Next, synchronize this directory with your remote directory on the live web server by clicking the twin “home” icon at the far upper right corner of the screen.
Choose Sync Home Now.
When the sync process is complete, your images will be available online. You can view the images individually to confirm this by going to an address that will look something like this:
The last half of this address, “~student2/images/image1.jpg”, will vary depending on which computer you are using and what you name your folders and images. Remember that folder names in your Sites folder have a 1-to-1 relationship with the resulting URL. For example if you created an “images” folder inside of Sites, and a “photowalk” folder inside of that, your resulting image URLs will look like:
Creating a CSV File
We will create a CSV file in Excel. A CSV file is essentially a set of data that, in this case, includes the web address of each photo, the latitude, longitude, image names, and any other information you ultimately decide to include.
Paste the Geotagged Data in Excel
First select all of the matched photo and location data in the HoudahGeo window by clicking on one of the entries and pressing Apple-A.
Then copy the entries by pressing Apple-C.
Open Excel and create a new blank workbook document.
Press Apple-V to paste the data into the document.
Separate the Data into Columns
You will see a string of characters, each existing only in the first column.
Each set of data is separated by a semicolon. For example, the photo name and file path is separated by a semicolon from the date ad time. We want to separate each of these types of data into separate columns. To do this, go to the top menu and choose Data: Text to Columns.
A pop-up window appears. Make sure the Delimited button is selected.
Press Next. Now, make sure only the Semicolon box is checked, since each data type is separated by a semicolon.
Press Next. In the final window, we simply keep the General button selected, then press Finish.
As a result, the information will be distributed into columns.
If any column is full of pound signs (#######), simply widen the column by clicking the top column button and dragging the margin to the right.
Before continuing, save the file as a CSV file in a folder associated with your project. The resulting file name should end with .csv, NOT .xls.
Correct the Photo Paths
We need to make sure that the photo URLs are correct in this file. Right now, the path is based on the local folders in your computer. We will do a find and replace to match the online location.
Here you can see the local path to the .jpg file. Highlight the entire path, except for the image title, and press Apple-C to copy it.
Next, go to the top menu and choose Edit: Replace.
In the pop-up window, paste in the local folder path in the Find what field.
Then, copy the web address of the path to your images. Using the example from the last step, the path would be: http://mysite.com/photos/photowalk/ Don’t forget to include the final forward slash at the end of the address. Paste that address into the Replace with field. Click Replace All.
Now, the proper web addresses should exist for each photo in the list.
Label the Columns
Next we must label each column by creating a header row.
Click the “1” button on the Excel document to select the entire first row.
Go to the top menu and choose Insert: Rows. A new row will appear.
In that new top row, label each of the columns in the same order they are labeled in HoudahGeo; the only difference is that the photo column should be labeled “Photo URL.” We won’t use the altitude data, so you can delete that.
The important column headers for use in ZeeMaps are:
- Photo URL
- Name — You can create this in an empty column into an empty column and then add a name to each image row.
The resulting file ought to look something like this:
Save the file. You now have a .csv file that can be uploaded to ZeeMaps to create a photo map.
Creating the Map
There are many systems and services available to post data to maps. To create our maps, we will use the free ZeeMaps web service. We prefer ZeeMaps for this purpose because it is a relatively straightforward prcess to create maps, yet we can create sophisticated, highly configurable maps that are rich with information and easy to post online.
We suggest going ahead and registering so you can save and manage every map you produce.
Simply press the Create link at the top of the web page to begin making the map.
A world map will appear, as well as a menu bar with several options.
Choose Advanced: Import CSV.
In the resulting upload window, click Browse to navigate to the CSV file you created. Click Open in the browser window to select the file. And then click Submit to upload the file to ZeeMaps.
A pink confirmation window should appear, listing each data type. A check box will appear next to data that ZeeMaps interprets to create the map. Other data that will appear in each mapped point will be listed as “entry property.”
If you are satisfied, scroll down and click Submit, at the bottom of the window. If you are signed in, the web site will display a message saying that it is processing your data and a confirmation e-mail will be sent when it is complete. With a relatively small data set, the processing typically happens in a very short amount of time, on the order of a few minutes or even a few seconds.
When you receive the e-mail, you can click the enclosed link to go directly to the map. You map will also be visible in the My Maps section, which can be reached by pressing the link in the upper right corner.
Publishing the Map
When you go to your map, it will probably be zoomed out to a global scale. You will have to zoom in by double-clicking or pressing the zoom scale on the left of the screen, while constantly dragging the target area to the middle of the screen.
You should also rename your map so it is easily identifiable. In the menu bar, click
Advanced > Map > Name.
In the panel that pops up, type in the name you prefer and press Submit.
Whenever you return to ZeeMaps, you can open up any of your saved maps by clicking the My Maps link in the upper right corner of the window.
When viewing your map, you can click on a marker on the map. A window pops up featuring a thumbnail of the photo (click it to open a larger version), the Name that you input into the CSV file, and any other information you included.
A handy way to view this map is with the item list open. Simply press the small box with the double-arrow symbol to open the list. It displays each item in alphabetical order by Name.
If you want to add the map to your web site or blog, simply press the Publish link in the upper right corner of the browser window.
You will have several publishing options. We tend to use the IFrame window, which is highly configurable and produces a link you can copy and paste into your own web site or blog.
Note to Tech Tools Workshop participants:
After pasting your map’s code into a blog posting, scroll to the bottom of the screen. Under Custom Functions, create a “full-width” key with a value of 1 (see below). This will enable the map to display at full size.
About this Tutorial
This tutorial was created by Timothy Lesle, Scot Hacker, Jerry Monti and Abbie Swanson.
This content may not be republished in print or digital form without express written permission from KDMC. Please see our Content Redistribution Policy at kdmc.berkeley.edu/license.