Creating images containing GPS data

Slashdot it! Delicious Share on Facebook Tweet! Digg!

Starting Material

The tools named bring some amazing things to light these days. They provide the camera manufacturer name, the device's ID code, and firmware version, as well as image size, aperture, and flash exposure time.

The list of items you need to create a geographic map consists of three things: the stages of the trip, the waypoint coordinates, and the photos taken at each waypoint. A text file with the location names is enough to nail the stages of the trip when creating the map.

A Global Positioning System (GPS) is the best way to get the waypoint coordinates. These give you the latitude and longitude, timestamp, and altitude measurement. This recorded data can provide the route profile that you can store in a route planner, such as GPSies [8].

As previously mentioned, digital images have metadata in so-called Exif tags. Table 1 shows the specific entries you can use for geolocation ("GPS tags"). You can find a more comprehensive overview of the Exif elements related to GPS in the TIFF Tag Reference [9] and on Exiftool author Phil Harvey's website [10].

Table 1

Tags for Geodata

GPSInfo Main tag
GPSLatitudeRef North or south latitude
GPSLatitude Latitude value
GPSLongitudeRef East or west longitude
GPSLongitude Longitude value
GPSAltitudeRef Above or below sea level altitude
GPSAltitude Altitude value

You can tell if an image already includes geodata by clicking on the corresponding image view entry or using the ExifTool and grep programs on the command line, as follows:

$ exiftool -s <imagefile> | grep -i gps

The command tells ExifTool to show the Exif tag name in the first output column, and then grep filters the output based on a case-insensitive (-i ) pattern search for gps .

No output means that the file contains no geodata. Figure 2 shows a successful search for an image's coordinates data. The GPSMapDatum entry shows the geodetic survey data used by the GPS receiver, such as WGS-84 or Tokyo .

Figure 2: Output of an image's geodata using the ExifTool.

Because the (GPSAltitude ) above sea level was not indicated in the example, using the following command:

$ exiftool -GPSAltitude=493 <imagefile>

you can modify the metadata to set the altitude to 493 meters above sea level, for example.

Determining Geodata

If the information isn't included with the image and no digital route data exists, you can add it manually. Usually, a Geonames.org query [11] is good enough. This database contains all available names of locations, regions, and countries and is full-text searchable over the web.

With multiple identical place names, a search list appears with further selections. Each reference includes a Google Maps reference, a short description and the coordinates. Figure 3 shows the results for Vaumarcus, Switzerland, the location of the DebConf 2013 conference.

Figure 3: Full-text search for a location name in the Geonames.org web browser.

Another option is OpenStreetMap and its Nominatim [12] (Latin for "by name" or "explicitly") service. It is used, for example, in Wikipedia to match locations with coordinates. Figure 4 shows an example.

Figure 4: Nominatim search results complete with map.

You can find previously recorded travel routes (commonly known as GPX tracks) on the GPSies, Waymarked Trails [13], and BBBike[14] websites. GPSies actually provides only traveled routes, with their ratings and detailed descriptions. Waymarked Trails includes inline skater and mountain bike routes along with trails and biking routes (Figure 5). BBBike provides a comparison of up to eight map variations with routes and variable background overlays (Figure 6).

Figure 5: Waymarked Trails bike routes around London.
Figure 6: BBBike lets you compare maps and activities.

These websites allow interactive waypoint marking on the map using the browser. You can then assemble the route and export it as a text file in GPX format [15], which is an XML format used for storing and sharing GPS data.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content