English

How To: Define projection for all files in a workspace

Summary

The instructions provided describe how to define the projection for all files in a workspace.

Procedure

In ArcMap, use model iteration to define the projection for all files in a workspace. The Define Projection tool is used when the files have no projection assigned.

Note:
Ensure the option 'When connecting elements, display valid parameters when more than one is available' in the Geoprocessing Option dialog box is checked. The ModelBuilder Connect tool presents the option to select the target parameters.
[O-Image]

  1. Create a new model.

    a. Navigate through the Catalog tree to a folder where a new toolbox can be created. Right-click the folder > New > Toolbox.
    b. Rename the toolbox as desired.
    c. Right-click the toolbox > New > Model. This creates a model in the toolbox and opens ModelBuilder for editing the model.
    d. In the toolbox, right-click the model and select Rename to give it a name appropriate to its intended task.

    Note:
    Users may also view model properties by right-clicking the model > Properties > General tab. Here, users can type a name, label, and description for the model.

  2. Add an iterator to the model.

    a. If the new model is not already open, right-click the model and select Edit to open the model window.
    b. In the model's main menu, click Insert > Iterators > Feature Classes. The iterator is white since no parameter values have been provided.
    c. Double-click the Iterate Feature Classes hexagon and set the following tool parameter.
    • Workspace or Feature Dataset: An input workspace where all feature classes to be modified are stored. Examples of workspaces are a folder, geodatabase, or feature dataset.
    Example

    [O-Image]

    Note:
    Two additional parameters, 'Wildcard' and 'Feature Type', are used to restrict the feature classes chosen for iteration. This iterator has two output variables: the output feature class file, and the name of the output feature class. The output feature class file can be connected to the next tool in the model for processing, and the Name variable can be used for inline variable substitution.


    d. Click OK after valid inputs are set in the Iterate Feature Class dialog box. A dark blue input is displayed.

    Note:
    ModelBuilder uses color to indicate the status of tools and variables. A white shape indicates input parameters have not been specified. Once entered, the iterator color changes to orange (other tools change to gold); inputs are displayed in blue and outputs in green.
    The iterator before and after parameter values have been provided.

    [O-Image]

  3. Add the Define Projection tool to the model.

    a. Go to ArcToolbox > Data Management Tools > Projections and Transformations.
    b. Drag and drop the Define Projection tool onto the ModelBuilder canvas in an empty area.
  4. In the model, use the Connect tool in the toolbar to connect the iterator’s output Feature Class variable to the Define Projection tool, and select 'Input Dataset or Feature Class.'
    Example

    [O-Image]
  5. In the model, double-click the Define Projection tool, and set the following tool parameters.

    • Input Dataset or Feature Class: A dataset or feature class whose projection is to be defined. If there are feature classes in the previously chosen workspace, this field is populated automatically with one of the feature classes. If the workspace is empty, this field shows a generic name as output.
    • Coordinate System: The coordinate system to be applied to the input.


    Note:
    The Define Projection tool is used to define the projection of a feature class that does not have any coordinate system set. When the tool is run from the model, it does not create a new feature class as output; it only sets the projection for the original feature class. If the tool is used on a feature class that already has a projection defined, the following error message is returned: "000132: The dataset already has a projection defined."

  6. Set the following model parameters.

    a. Right-click the dark blue input to the iterator, and check the Model Parameter option. This exposes the parameter when the model is run from its toolbox.
    b. Right-click the Define Projection tool, and select Make Variable > From Parameter > Coordinate System.
    c. Right-click the Coordinate System oval, and check the Model Parameter option.
    Example

    [O-Image]
  7. Validate the model to check for any errors. Go to the model menu > Validate Entire Model.
    Example

    [O-Image]
    Note:
    A process in the model is ready to run only when all required parameters are provided for the iterator and the tool. In the model window, ensure all boxes and ovals are filled with color before running the model.

  8. Save the model, and go to Model > Model Properties > Parameters. View the parameter properties and change the names and order of parameters as desired.
    Example

    [O-Image]
    To summarize what has been accomplished: The Iterate Feature Classes tool iterates over feature classes in a workspace. The output of the iterator is given to the Define Projection tool. The Define Projection tool modifies the input feature class rather than creating a new output feature class. When the model is run, the projection of the feature classes in the workspace is set by the tool.
  9. Run the model from its toolbox in ArcCatalog or the Catalog window in ArcMap.

Related Information