KML/KMZ supports the ability to attach images to points. This can have a valuable application in either personal or professional use. For personal use, it can allow the user to take memorable photos when hiking or exploring while recording a track in another app, such as GaiaGPS, and then importing that data into ArcGIS. For professional use, it could be beneficial for field work, allowing person in the field to record photos attached to waypoints in the tool of their choice and then import them later to ArcGIS for analysis.
Currently the KML to Layer function does not import any photos that are attached to points. This idea is to update that function to do so. This idea is part of Enhancement Request (NIM086198) - "Images in pop-ups from KML are not maintained with the KML to Layer geoprocessing tool."
I'd love this option too.
Any updates on this or any work around?
@COH_Spatial it is in our near term plan for KML To Layer, which includes other important enhancements and bug fixes as well. It will not be complete in ArcGIS Pro 3.2 which is the next release coming this year.
Up voting this idea as our organization would find this solution very helpful.
Just adding my support to this. Great idea and would be very useful
I should have checked this before commenting, but it seems this is now implemented at 3.3.0. Happy days 🙂
@DrewFlater Could you mark it as such for anyone else who arrives here?
@RichardHowe our internal development issue is still open for this enhancement idea, it is currently in our Pro 3.5 plan though plans are subject to change. I just retested with KMZ that another user had provided, and the image files were not carried forward into the geodatabase or output layer after running KML To Layer.
@DrewFlater I'll hold my hands up. I was reading this the other way around i.e. feature classes with attachments converted to KML (which does work). Sorry 🙂
This would be great. My current convoluted workflow - Use Avenza Pro to export a shapefile. It automatically creates a folder of attachments and adds a new field with a comma-delimited list of attachments for each feature. Import the shapefile into a GDB w/ attachments and globalIDs enabled, and then use this field to build an attachment table and re-attach the photos:
import arcpy
import os
#%%
# set variables
gdb_path = r"scratch.gdb"
base_folder = r"gps\layername"
feature_class = "name_of_shp"
file_path_field = "Photos"
#%%
# loop through features. for each feature, if file_path_field is not null, split the string into a list of file paths
# for each file path, construct the full path and add the file as an attachment to the feature
arcpy.env.workspace = gdb_path
# Create a match table
match_table = 'MatchTable'
arcpy.CreateTable_management(arcpy.env.workspace, match_table)
arcpy.AddField_management(match_table, 'GlobalID', 'TEXT')
arcpy.AddField_management(match_table, 'FILE_PATH', 'TEXT')
# Populate the match table
with arcpy.da.SearchCursor(feature_class, ["GLOBALID@", file_path_field]) as cursor:
with arcpy.da.InsertCursor(match_table, ['GlobalID', 'FILE_PATH']) as icursor:
for row in cursor:
if not (row[1] is None or row[1] == ""):
file_paths = row[1].split(", ")
if len(file_paths) > 0:
for file_path in file_paths:
# convert forward slashes to backslash
file_path = file_path.replace("/", "\\")
full_path = os.path.join(base_folder, file_path)
icursor.insertRow([row[0], full_path])
#%%
# Add attachments
arcpy.AddAttachments_management(feature_class, "GlobalID", match_table, "GlobalID", "FILE_PATH")
#%%
# Delete the match table
arcpy.Delete_management(match_table)
# %%
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.