I am trying to join two feature classes together and also keep the spatial geometry of the join features. I want to keep the target and output geometry the same but also have a field like JoinSHAPE where I can access the geometry of the feature that it was joined with.
I have tried to add a field mapping for the join feature but an error occurs.
RuntimeError: FieldMap: Error in adding input field to field map
when I run the code below.
import arcpy
target = arcpy.GetParameter(0)
join_features = arcpy.GetParameter(1)
output = r"S:\GIS TOOLS\Workbench.gdb\asdf"
fieldmappings = arcpy.FieldMappings()
fieldmappings.addTable(target)
fieldmappings.addTable(join_features)
shape = arcpy.FieldMap()
shape.addInputField(join_features, "SHAPE@")
fieldmappings.addFieldMap(shape)
arcpy.SpatialJoin_analysis(target, join_features, output, "#", "#", fieldmappings)