Newbie question----How do I copy fields that are populated with domains from one shapefile to another shapefile

3436
6
Jump to solution
08-27-2015 11:13 AM
MasonCounty
New Contributor II

I'm new at this, and I presume this is probably an easy task, but I can't seem to find a process. I have a shapefile that I have added four new fields, and I've set up domains for each of these fields. One of the domains has a total of 76 options, so I want to avoid doing this process again. My goal is to copy the fields from one shapefile to another, and maintain the domains in both shapefiles . Is this possible?

The data is for a noxious weed program I'm working on. Both shapefiles live in the same geodatabase. One contains the point locations, and the other contains the area locations. Both shapefiles are populated with the same information, so the domains will be the same.

There may be a better/different way to accomplish my goal, so I'm open for tips, suggestions, pointers, sarcasm, knowledge, or anything. Thank you in advance!

Jason

0 Kudos
1 Solution

Accepted Solutions
WesMiller
Regular Contributor III

When create the fields preferably in catalog you can set the domain for that field if they are in the same geodatabase. If they are in different geodatabases use the domain to table tool to get the domain then the table to domain tool to put in the new\other geodatabase.

View solution in original post

6 Replies
WesMiller
Regular Contributor III

When create the fields preferably in catalog you can set the domain for that field if they are in the same geodatabase. If they are in different geodatabases use the domain to table tool to get the domain then the table to domain tool to put in the new\other geodatabase.

DarrenWiens2
MVP Honored Contributor

Just semantics, but once your shapefile is in a geodatabase, it is no longer in the shapefile file format, and is now a geodatabase feature class.

About the domains, you can export Domain to Table, then import using Table to Domain. Alternatively, you can simply make a copy of the feature class, then wipe its contents using Delete Features (the table schema will remain).

alex_friant
Occasional Contributor II

Since you are a "newbie", I'd like to explain some basic terminology corrections since it aids in communication.

The items you are speaking of are called "feature classes", not "shapefiles". Shapefiles exist outside of a geodatabase and are a completely different data storage format. Also, shapefiles do not have the capability of holding / using domains.

The domains are stored inside the geodatabase and can be used with as many feature classes inside the geodatabase you like. So, you can create your first feature class "weed_points". While creating the fields make sure to choose the domains you created where appropriate for each field.

Now, create a second feature class called "weed_areas", and when you get to the field creation window click the "Import" button and pick the "weed_points" feature class.  Voila! All your fields in weed_points will now exist in "weed_areas".

These feature classes will be empty, but you can load any existing data you have into them from previously existing feature classes.

EarlSarow
New Contributor III

Take a look at the "Join Field" tool in the Data Management toolbox.   It will append any or all of the attribute fields from one feature class onto another.   Use "ObjectID" for the input and output Join Fields.   There do not need to be any records in either of the feature classes (the tool works on tables, too).

Any domains attached to fields in your first feature class will be attached to those fields when they are added to the second feature class.

A couple of other useful tools if you find you need to duplicate a large domain are "Domain to Table" and "table to Domain", also in the data management toolbox.

MasonCounty
New Contributor II

Thank you all! My mentor moved on to a new job, so I have to learn by reading help files and trial and error. The help files are not always helpful since I don't know the correct terminology. Cheers!

0 Kudos
OwenEarley
Occasional Contributor III

One option that has not been mentioned is the Assign Domain to Field tool. The domains are already set up in your geodatabase so you can use this tool to assign them to fields in any feature class within the geodatabase.

0 Kudos