Match Photos To Rows By Time (Data Management)

License Level:BasicStandardAdvanced

Summary

Matches photo files to table or feature class rows according to the photo and row time stamps. The row with the time stamp closest to the capture time of a photo will be matched to that photo. Creates a new table containing the ObjectIDs from the input rows and their matching photo paths. Optionally adds matching photo files to the rows of the input table as geodatabase attachments.

Illustration

Match Photos To Rows By Time illustration

Usage

Syntax

MatchPhotosToRowsByTime_management (Input_Folder, Input_Table, Time_Field, Output_Table, {Unmatched_Photos_Table}, {Add_Photos_As_Attachments}, {Time_Tolerance}, {Clock_Offset})
ParameterExplanationData Type
Input_Folder

The folder where photo files are located. This folder is scanned recursively for photo files; any photos in the base level of the folder, as well as in any subfolders, will be added to the output.

Folder
Input_Table

The table or feature class whose rows will be matched with photo files. The input table will typically be a point feature class representing GPS recordings.

TableView
Time_Field

The date/time field from the input table that indicates when each row was captured or created. Must be a date field; cannot be a string or numeric field.

Field
Output_Table

The output table containing the OBJECTIDs from the input table that match a photo, and the matching photo path. Only OBJECTIDs from the input table that are found to match a photo are included in the output table.

Table
Unmatched_Photos_Table
(Optional)

The optional output table that will list any photo files in the input folder with an invalid time stamp or any photos that cannot be matched because there is no input row within the time tolerance.

If no path is specified, this table will not be created.

Table
Add_Photos_As_Attachments
(Optional)

Specifies if photo files will be added to the rows of the input table as geodatabase attachments.

LicenseLicense:

Adding attachments requires at minimum an ArcGIS for Desktop Standard license, and the output feature class must be in a version 10 or higher geodatabase.

  • ADD_ATTACHMENTS Photo files will be added to the rows of the input table as geodatabase attachments. Geodatabase attachments are copied internally to the geodatabase. This is the default.
  • NO_ATTACHMENTS Photo files will not be added to the rows of the input table as geodatabase attachments.
Boolean
Time_Tolerance
(Optional)

The maximum difference (in seconds) between the date/time of an input row and a photo file that will be matched. If an input row and a photo file have time stamps that are different by more than this tolerance, no match will occur. To match a photo file to a row with the closest time stamp, regardless of how large the date/time difference might be, set the tolerance to 0. The sign of this value (- or +) is irrelevant; the absolute value of the number specified will be used.

Do not use this parameter to adjust for consistent shifts or offsets between the times recorded by the GPS and the digital camera. Use the Clock Offset parameter, or the Convert Time Zone tool to shift the time stamps of the input rows to match those of the photos.

Double
Clock_Offset
(Optional)

The difference (in seconds) between the internal clock of the digital camera used to capture the photos and the GPS unit. If the clock of the digital camera is behind the clock of the GPS unit, use a positive value; if the clock of the digital camera is ahead of the clock of the GPS unit, use a negative value.

For example, if a photo with a time stamp of 11:35:17 should match a row with a time stamp of 11:35:32, use a Clock Offset of 15.

Double

Code Sample

MatchPhotosToRowsByTime example (Python window)

The following Python window snippet demonstrates how to use the MatchPhotosToRowsByTime tool.

import arcpy
arcpy.MatchPhotosToRowsByTime_management("c:/data/photos", "c:/data/city.gdb/gps_points", "DateTime", "c:/data/city.gdb/output_table", "", "ADD_ATTACHMENTS", "", 20)
MatchPhotosToRowsByTime example (stand-alone script)

The following script demonstrates how to use the MatchPhotosToRowsByTime tool.

"""Name: GeoTaggedPhotosToPoints example
Description: Find the points that match photo time stamps, then join the output table 
             to the input to see which photos match which points
""" 

# Import system modules
import arcpy
from arcpy import env
 
# Set environment settings
env.workspace = "C:/data"
 
# Set local variables
inFolder = "photos"
inFC = "city.gdb/gps_points"
timeField = "DateTime"
outTable = "city.gdb/output_table"
outUnmatched = "city.gdb/unmatched_photos"
attachmentsOption = "ADD_ATTACHMENTS"
timeDiff = 0
timeOffset = 20

# Execute MatchPhotosToRowsByTime and JoinField
arcpy.MatchPhotosToRowsByTime_management(inFolder, inFC, timeField, outTable, outUnmatched, attachmentsOption, timeDiff, timeOffset)
arcpy.JoinField_management(inFC, "OBJECTID", outTable, "IN_FID", "Photo_Path;Photo_Name;Match_Diff")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Limited
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
11/18/2013