0

I have two shapefiles both containing the same attributes. However, when I merge them, instead of adding the fields vertically, it's adding the fields from one shapefile to another. Resulting in empty columns, is this happening because my field names are different as I'm joining them with CSVs?

enter image description here

8
  • "Merge", not "Append"? As the Merge tool doc states, Use the Append tool to combine input datasets with an existing dataset.
    – Vince
    Aug 3 at 1:57
  • @vince i tried doing that but i get schema does not match even though the variables have same datatype just different names
    – Charan
    Aug 3 at 2:05
  • So you're getting what you asked for. If you want an Append, you need to make sure the feature classes have the same columns (name and type) or you need to get very good with field mapping.
    – Vince
    Aug 3 at 2:23
  • @Vince what's the easiest and quickest way cuz rn im doing 2 shapefiles, but later i will be appending a lot of layers
    – Charan
    Aug 3 at 2:27
  • The easiest way is to name the columns as you need them from the start.
    – Vince
    Aug 3 at 2:48

1 Answer 1

1

The problem your facing is the subject of datacleaning. If you have two datasets with the same attributes with different spellings/names/type(string or numeric ea), using tools as merge or append will regard the attributes as different/unique or throw an error (in case of non matching data types). So before merging or appending datasets/tables, you will always have to make sure the type and name of matching attributes are the same.

In ArcGIS Pro, you can use the Field Map option within the Merge tool. You can delete all output fields that you don't want to keep. Then you can select each output field. When selecting an output field, source will show you all datasets that have a matching attribute field name. You will then have to add all datasources for which you need to map the attribute with the wrong field name to the selected Output field name (this will hopefully make sense when you try it). You will have to do this for all the output fields you want to keep. If you perform a merge on all layers in one step, you will have the least amount of work when using the Field Map option (compared to doing the merges in multiple steps). Otherwise you will have to go through the output fields multiple times.

Alternatively you can easily rename columns/field names in QGIS before bringing the shapefiles into ArcGIS. Or if the problem is with the column names in the CSV files, just use any text editor to change the column names.

Regarding the use of merge or append in ArcGIS Pro: The Merge tool and Append tool in ArcGIS can combine data from different datasets in the same way, depending on how you setup the tools. The most important difference between them (to me at least) is that Merge will write the result to a new dataset, while Append will add the data to an existing or target dataset. For these types of operations I like the use of the Merge tool as it is often safer as with Merge you leave the original datasets intact. If you use Merge (in the ModelBuilder) in a series of operations, you can use Append following a merge without changing your input data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.