Converting Picasa Photos and NMEA Tracks into Feature Classes or Shapefiles

Converting Picasa Photos and NMEA Tracks into Feature Classes or Shapefiles

I like to hike and take pictures and wanted to have a shareable, visual map tying travel and pictures together. For my final project in USC’s Spatial Science GIS Programming and Customization class, I created python scripts that processes a Picasa photo album and converts geotagged photos into a feature class or shapefile. The scripts also can process an NMEA file produced by a geologger and convert the tracks into a line feature class or shape file. The shapefiles can easily be zipped up and imported into ArcGIS online to share with friends and family.

At the time the python scripts and ArcMap toolboxes were created, there was not a tool to convert directly from an NMEA file to shapefile: one first needed to convert to gpx. There also wasn’t a way to bring Picasa files into ArcMap. Over the past year, ESRI developed an interface from the Storymap creation template on ArcGIS Online to grab an album from Picasa (one of the Storymap project team attended my presentation at the 2013 ESRI Developer ‘s Conference and asked for the code sample). If you have an ArcGIS organizational account, the Storymap data can be exported to shapefile or CSV.

ArcGIS from NMEA and Picasa

ArcGIS Map from SHP  created NMEA log and Picasa Album

 

Code and Video Links

The python scripts are available for download at Map your trip: Geologger NMEA format file and Picasa Photos to Shapefile or Feature Class. The video from my presentation at the 2013 ESRI Developer’s Conference, “Got Pics? More Ways to Make Your Friends Jealous Through Publishing Your Geotagged Photos,” The presentation slides are available here.

 Script and Installation Details

The python scripts allow you to convert a NMEA file into a line feature in ArcMap and to get a Picasa photo album and create point features for each geotaggged photo. NMEA is a format that contains GPS information and is used by some geologgers. The Picasa photos must have lat/long already stored in the EXIF information. Various EXIF fields are also imported into the feature class. The scripts are independent of one another. If shapefiles are created, they can be zipped up and then imported into ArcGIS online, allowing you to create a map of a trip that is easily shareable. Configuring popups enables you to see the picasa pictures.
There are two scripts associated with the Pics_and_Trails toolbox. Convert NMEA to SHP calls C:\nmea_to_fc.py and Get Picasa Album calls C:\get_album.py. You must copy the two python scripts to C:\ or change the properties of Convert NMEA to SHP and Get Picasa Album to reflect the location of the python scripts. Install the Pics_and_Trails Toolbox in ArcCatalog where convenient.

Inputs for Convert NMEA to SHP

  • Workspace to add new shapefile or feature class. If a folder selected, a shapefile is created; if a geodatabase selected, a feature class is created.
  • Location of NMEA log
  • Output Name (must include .shp if a folder workspace selected)
  • Name for trail
  • Description

Outputs shapefile or feature class

Inputs for Get Picasa Album

  • Workspace to add new shapefile or feature class
  • Output Name (must include .shp if a folder workspace selected)
  • Picasa User name (username@email.com)

Outputs shapefile or feature class

Outputs shapefileor feature class

The Google API library must be installed and accessible from PYTHONPATH!!!
To install the Google API library, go to https://code.google.com/p/gdata-python-client/downloads/list
Follow the install instructions, then verify install location of gdata folder (the google library) is in your python path PYTHONPATH variable.

Python Path examples for Google API library

Example 1.

C:\Python26\gdata –install location of Google API library
>>> import os
>>> os.environ[‘PYTHONPATH’].split(os.pathsep)
[‘C:\\Python26’, ‘C:\\Program Files (x86)\\ArcGIS\\Desktop10.0\\bin’, ‘C:\\Program Files (x86)\\ArcGIS\\Desktop10.0\\ArcPy‘, ‘C:\\Program Files (x86)\\ArcGIS\\Desktop10.0\\ArcToolbox\\Scripts’]

 Example 2

python setup.pyinstall – see install instructions with library  – installed in site-packages in 2.7
>>> import os
>>> os.environ[‘PYTHONPATH’].split(os.pathsep)
[‘C:\\Python27’, ‘C:\\Python27\\ArcGIS10.1\\Lib\\site-packages’, ‘C:\\Python27\\ArcGIS10.1’]
Tkinter is used in the get_album.py script to create an interactive script that provides a list of album names for a given user and asks for an album choice.

Have your say