I am using ArcGIS 10.2.2, Python 2.7. I want to create a spatial reference from the name of a projection, e.g. NAD_1983_BC_Environment_Albers, using the arcpy tool arcpy.CreateSpatialReference_management(). Consider this:
projName = "NAD_1983_BC_Environment_Albers" #Replace underscores with spaces, works fine. sr = arcpy.CreateSpatialReference_management(projName.replace('_',' '))
No issues here. Also, I tried the example in the arcpy documentation here:
projName = "NAD 1983 StatePlane California V FIPS 0405 (US Feet)" sr = arcpy.CreateSpatialReference_management(projName)
This also works fine. So, why does the following generate an error?
projName = "NAD_1983_UTM_Zone_9N" #Tried both with and without converting underscores to spaces sr = arcpy.CreateSpatialReference_management(projName.replace('_',' ')) ERROR 000622: Failed to execute (Create Spatial Reference). Parameters are not valid. ERROR 000628: Cannot set input into parameter spatial_reference.