i have many (>15) shapefiles which have slightly differing fields.
s1: (Name, age, layer_1, ...) s2: (Name, age, layer_1, layer_2, ...) ... s_n: (Name, age, layer_1, layer_1_extra, ...)
I want to combine s1,s2 up to s_n into a new feature class/shapefile with attributes
s_merge: (Name, age, layer_1, layer_1_extra, layer_2, ...)
Field order is irrelevant. layer_1_extra should be set to ' ' or 0 depending on type, where features come from e.g. s1 ()which does not have layer_1_extra)).
Do I have to program this myself using search cursors (to get the field names), add field tool and insert cursors, or is there a way to coerce e.g. the merge tool to do what I want?
So far i tried to use the merge tool, but this fails with
arcgisscripting.ExecuteError: ERROR 001156: Failed on input OID 0, could not write value ' ' to output field SCHICHT_2
Field SCHICHT_2 is a number field, so of course arcgis can't write ' ' to it.
Code for setting the fieldMap is
for shapepath in ...: land_shape_paths.append(shapepath) fieldMappings.addTable(shapepath) arcpy.Merge_management(land_shape_paths, land+'_full.shp', fieldMappings)
I had guessed ArcGIS was aware of field types and tried to write sensible "empty" values depending on field type. Apparently not, or my data is more botched than I think.
Any help (especially on a tool more suited to my needs than merge, or on the needed fieldMap magic) is appreciated!