Spatial reference and geoprocessing
The spatial reference of a geodataset is made up of the following:
- A coordinate system that consists of a map projection and datum
- XY resolution and, optionally, M and Z resolution and domain
- XY tolerances and, optionally, M and Z tolerances
These spatial reference properties can have significant impact on the performance and results generated by a geoprocessing tool.
- When a geoprocessing tool creates output data, a spatial reference must be assigned to that newly created dataset.
- When a geoprocessing tool processes features from more than one feature class (for example the Intersect tool) or from more than one raster (for example the Weighted Overlay tool), the data must be brought into a common spatial reference to compute relationships between contents of the two datasets.
The spatial reference of the output dataset and the spatial reference in which the processing occurs are one and the same. Another way to state this is that tools always process data in the spatial reference of the output dataset.
What is the default output spatial reference?
Geoprocessing tools determine the output spatial reference using the following logic:
- If the output is inside a feature dataset, the spatial reference properties of the feature dataset are used.
- If the output is a stand-alone geodataset (not inside a feature dataset), the spatial reference properties are the same as the input geodataset's spatial reference properties.
- If the input is a layer in a display, that spatial reference of the layer's data source is used.
- If the input is a list of datasets (for example, the Intersect tool), the spatial reference of the first input dataset will be used.
- If the tool doesn't have an input dataset (for example, Create Feature Class, Create Feature Dataset, and Create Raster Catalog), it is particularly important to choose a coordinate system so that the remainder of the spatial reference properties (such as XY resolution and tolerance) can be calculated by the tool.
How to override the default spatial reference's properties
The geoprocessing environments listed below can be used to override the following default output spatial reference properties. If the output is inside a feature dataset, the coordinate system, as well as the XY and Z properties (except Z awareness), will always be that of the feature dataset .
- Coordinate System
- XY Tolerance
- Z Tolerance
- XY Resolution
- XY Domain—Ignored for output in a post-9.2 geodatabase
- Output Z Aware
- Default Output Z Value
- Z Resolution
- Z Domain
The following environments can be used regardless of whether the output is stand alone or in a feature dataset:
For shapefile output, see Geoprocessing considerations for shapefile output.
Tools with multiple inputs—coordinate system affects tool performance
Geoprocessing tools that take multiple inputs, such as tools in the Analysis toolbox or Spatial Analyst toolbox, require all features or rasters to be in a common coordinate system to compute spatial relationships. Consider the Intersect tool, which computes the geometric intersection of multiple feature classes. Suppose that five feature classes are specified as input; the first feature class input has a UTM coordinate system while the remaining four feature classes have an Albers coordinate system. Because the first feature class is in UTM, the features in the other four feature classes will first be projected from Albers to UTM by the Intersect tool before it begins processing them. Projecting these datasets can significantly degrade performance; it may be far more efficient to project the one feature class from UTM to Albers rather than four feature classes from Albers to UTM. Conversely, if the feature class in UTM has many features compared to the total number of features in the other four feature classes, it would be more efficient to project the other feature classes from Albers to UTM.
To improve performance of the above situation, you can employ one of two techniques:
- Set the geoprocessing output coordinate system environment variable to the appropriate coordinate system (Albers in the above example). Anytime the output coordinate system environment is specified, it is recommended that you specify an appropriate geographic transformation if necessary.
- Ensure that the first geodataset input to the tool contains the coordinate system that will minimize the amount of data being projected (Albers in the above example).
Avoid unknown coordinate systems
Processing data with an appropriate coordinate system allows better default values for tolerance, resolution, and domains.
You should avoid processing data with an unknown coordinate system because the default tolerances may not be appropriate for the tool. The XY Tolerance default for an unknown coordinate system is 0.001 units—this is an exceedingly large value if the data's coordinates are in a geographic coordinate system where one unit (decimal degrees) represents up to 110 kilometers distance on the earth's surface, meaning the tolerance used for processing could be as large as 110 meters.
For help on how to proceed if the data has an unknown coordinate system, see Identifying an unknown coordinate system.
Coordinate system affects tool result
The spatial or topological relationship shared by two geometries in one coordinate system may change when projected to a different coordinate system. For example, the illustration below shows a blue line that connects the cities of Jakarta and Wellington. Depending on the coordinate system in which the data is projected and processed, the blue line connecting the two cities may or may not intersect the city of Alice Springs. It is important to choose a coordinate system that is appropriate for the data.
Setting the coordinate system environment in ModelBuilder
The output coordinate system environment can be set for an individual process (a process is a tool plus its input and output data) or for the entire model. Setting the environment at the process level affects only the execution of the individual process. Setting the environment at the model level affects all processes in the model.
To set the coordinate system at the process level
- In ModelBuilder, right-click a tool element.
- Click Make Variable > From Environment > Output Coordinates > Output Coordinate System. A new variable named Output Coordinate System is created and connected to the tool.
- Double-click Output Coordinate System and enter the appropriate coordinate system, which is usually the coordinate system of the largest geodataset input to the tool.
To set the coordinate system at the model level
- In ModelBuilder, click Model > Model Properties. Alternatively, in the Catalog or ArcToolbox window, right-click the model and click Properties.
- Click the Environments tab.
- Expand Output Coordinates.
- Check Output Coordinate System.
- Click the Values button.
- On the Environment Settings dialog box, expand Output Coordinate Settings.
- In the Output Coordinate System list, choose As Specified Below.
- Click the browse button to browse for an existing coordinate system, or choose a model variable in the drop-down list.