Lets say I have three shapefiles/features I want to merge:
'florida.shp', 'mississipi.shp' and
'louisiana.shp'. They all have 3 standard fields common to all:
'DFIRMID', 'SFX', and 'FIRMPAN'. I want to do a merge of the three shapefiles on just those three fields. My output should be a
'gulfstates.shp'. I am a little confused as to how I would use
merge. Since these are the only fields I want to keep in my merge and since they are common to all three shapefiles, could I literally just use field mapping to remove all other fields? Is there an easier way to do this?
fieldMappings = arcpy.FieldMappings() fieldMappings.addTable('florida.shp') fieldMappings.addTable('mississipi.shp') fieldMappings.addTable('louisiana.shp') for field in fieldMappings.fields: if field.name not in ['DFIRMID', 'SFX','FIRMPAN']: fieldMappings.removeFieldMap(fieldMappings.findFieldMapIndex(field.name))