ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Create Spatial Reference

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Creates a spatial reference object for use in ModelBuilder.

Use the SpatialReference class to create a spatial reference object to use in a script.

Usage

  • You can create a spatial reference object with set coordinate system, spatial domains, and precision. The spatial domains and precision of the output spatial reference can be further modified using XY Domain, Z Domain, M Domain, Template XYDomains, and Grow XYDomain By Percentage parameters.

  • Template XYDomains does not have to be in the same coordinate system as that specified in Spatial Reference or Spatial Reference Template. If they are different, the extents will be projected to match.

  • If the Spatial Reference and Spatial Reference Template parameters are both set, spatial reference parameter will take priority.

  • All the parameters of the tool are optional. If no parameters are specified, the spatial reference will be defined as 'Unknown' and the XYDomain will assume standard defaults.

  • In ModelBuilder, the output of this tool can be used as input to tools with a spatial reference parameter (e.g., Create Feature Class, Create Feature Dataset, Make XY Event Layer).

Syntax

CreateSpatialReference_management ({spatial_reference}, {spatial_reference_template}, {xy_domain}, {z_domain}, {m_domain}, {template}, {expand_ratio})
ParameterExplanationData Type
spatial_reference
(Optional)

Name of the the spatial reference object to be created.

Spatial Reference
spatial_reference_template
(Optional)

The feature class or layer to be used as a template to set the value for the spatial reference.

Feature Layer; Raster Catalog Layer; Raster Dataset
xy_domain
(Optional)

Allowable coordinate range for x,y coordinates.

Envelope
z_domain
(Optional)

Allowable coordinate range for z values.

String
m_domain
(Optional)

Allowable coordinate range for m values.

String
template
[template,...]
(Optional)

Feature classes or layers that can be used to define the XY Domain.

Feature Layer
expand_ratio
(Optional)

Percentage by which the XY Domain will be expanded.

Double

Code sample

Create Spatial Reference example (stand-alone script)

The following stand-alone script uses the CreateSpatialReference function as part of a workflow that loops through a folder and finds all shapefiles that end in "ST", create spatial references, and append them into a geodatabase feature class.

# This script reprojects a shapefile in Redlands folder
# from NAD 1983 UTM Zone 11N
# to NAD 1983 StatePlane California V FIPS 0405 (US Feet)

# import system modules
import arcpy
 
try:
    # set the workspace environment
    arcpy.env.workspace = r"C:\data\Redlands"

    # create a spatial reference object to be used as output coordinate system
    out_sr = arcpy.CreateSpatialReference_management("NAD 1983 StatePlane California V FIPS 0405 (US Feet)")

    # use the output of CreateSpatialReference as input to Project tool
    # to reproject the shapefile
    arcpy.Project_management("citylimit_Project1.shp", "city_CA_FIPS0405", out_sr)

except arcpy.ExecuteError:
    # print geoprocessing message
    print(arcpy.GetMessages(2))
          
except Exception as ex:
    # print the exception message
    print(ex.args[0])

Environments

This tool does not use any geoprocessing environments

Licensing information

  • ArcGIS for Desktop Basic: Yes
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes

Related topics

  • An overview of the Projections and Transformations toolset
  • Spatial reference and geoprocessing
  • An overview of spatial references

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal