Spatial reference considerations for geoprocessing services
All geodatasets in ArcGIS contain a spatial reference. A spatial reference consists of a coordinate system, tolerance, resolution, and x,y and z domains. The coordinate system defines the map units, such as meters, feet, or longitude and latitude, and the map projection of the data. Coordinate systems can be unprojected (geographic coordinate system) or projected (state plane or UTM, for example).
Learn more about spatial reference
Output data coordinate transformations are handled by ArcGIS Server
All ArcGIS Server clients have the ability to request output data in any coordinate system. ArcGIS Server handles all coordinate conversions for you and sends data back to the client in the coordinate system it requests. You do not have to modify your models or scripts in any way.
Coordinate system affects tool performance
Geoprocessing tools that transform data, such as tools in the Analysis toolbox or Spatial Analyst toolbox, use a coordinate system to process data. The default coordinate system is that of the first input geodataset. Sometimes, this default is not appropriate. Consider the Intersect tool, which computes the geometric intersection of multiple feature classes. Suppose that five feature classes are input to Intersect. The first feature class input has a UTM coordinate system. The remaining four feature classes have an Albers coordinate system. Because the first feature class is in UTM, the remaining four feature classes will undergo a coordinate transformation from Albers to UTM before the Intersect tool begins computing the intersection. This transformation degrades performance: it would be far more efficient to transform the one feature class from UTM to Albers rather than four feature classes from Albers to UTM. To improve performance, 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). This is the recommended technique.
- Ensure that the first feature class input to the tool contains the appropriate coordinate system (Albers in the above example). Input feature set parameters contain the coordinate system of the client's display, which is typically an unprojected coordinate system.
In addition to individual tools determining a coordinate system to process data, ArcGIS Server clients can set a processing coordinate system. This is not recommended practice, and in reality, few clients will set the processing coordinate system, but it is still a possibility. When the client sets a processing coordinate system, all tools within a model will use this coordinate system. For example, the client could set the processing coordinate system to WGS84 (a geographic coordinate system). Continuing with the example above, all five datasets would be transformed into WGS84 before the Intersect tool began computing the intersection. You can override the setting of the processing coordinate system by clients by setting the output coordinate system environment variable.
When should I set the coordinate system environment?
Any tool that accepts more than one geodataset is most likely affected by the coordinate system environment. Consult the tool's reference page; it will list coordinate system as one of the environments that affect the tool.
What should I set it to?
In general, you set the coordinate system to that of the largest dataset (that is, most features or raster cells). The idea is to transform the smallest number of features, so by setting the coordinate system to the dataset (or datasets) with the most features, a smaller number of features will be transformed.
How do I set the coordinate system environment?
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.
- 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 ArcToolbox or Catalog 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 Coordinates.
- 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.
Learn more about setting model environments
Learn more about environment settings
For an example of using coordinate systems, see GP service example: Clip and ship. This model outputs a .zip file containing a file geodatabase, and the model can be modified so that the geodatasets in the output file geodatabase have a coordinate system of your choice.