[GIS] How to load features into empty feature class using stand-alone arcpy script

arcpyfeature-classfeatures

I have an empty feature class that I would like to populate with features from source feature classes. I have done this manually using the Object Loader. However, I would like to automate the process with my stand-alone python script.

I considered using append, but my target and source feature class schemas are different. I have seen some script for Load Data, however, it is unclear if and how I can create a cross reference database with arcpy.

So, I am wondering if there is an arcpy equivalent to the manual Object Loader.

Best Answer

I believe using Append geoprocessing tool would be the most robust approach to load data into the target feature class.

The tool has field_mapping parameter which you can specify to map your input fields to the output fields. If it is just one time job, you might consider running the tool manually in ArcMap, mapping the input/output fields. You could optionally copy the result of this run as a Python code snippet and then re-use. However, the field mapping will be represented as a huge string which will make it difficult to perform larger adjustments.

For the data load, it is usually recommended to use the field mappings object. You can learn more about them at Mapping input fields to output fields. It might take some time to learn how they work, but then they are unbeatable in terms of the flexibility of field management.

There are a couple of posts that could help you get started with the field mapping and Append here and here.

Related Question