This seems like to should be an easy thing to do, but I can't seem to make it work.
arcpy.env.workspace = arcpy.GetParameterAsText(0)
output_working = arcpy.GetParameterAsText(1)
PLSS_Intersected = arcpy.GetParameterAsText(2)
spatial_ref = arcpy.GetParameterAsText(3)
outCS = arcpy.SpatialReference("spatial_ref")
outfc = os.path.join(output_working, "PLSS_Intersected")
arcpy.Project_management(PLSS_Intersected, outfc, outCS)
EDIT:
How is the error massage that I receive. The very top is what prints out when I printed outCS.enter image description here
1 Answer 1
Although the comments have identified the immediate problem (that you are using the string literal, "spatial_ref", rather than the variable, spatial_ref), you may find it easier to change the input parameter to data type = Spatial Reference, and use the spatial reference object itself, rather than converting the spatial reference to string and back to a spatial reference object.
arcpy.env.workspace = arcpy.GetParameterAsText(0)
output_working = arcpy.GetParameterAsText(1)
PLSS_Intersected = arcpy.GetParameterAsText(2)
spatial_ref = arcpy.GetParameter(3) # get spatial reference object
outfc = os.path.join(output_working, "PLSS_Intersected")
arcpy.Project_management(PLSS_Intersected, outfc, spatial_ref) # set spatial reference to the object
'spatial_ref'
toarcpy.SpatialReference
rather than the value you have assigned tospatial_ref
viaarcpy.GetParameterAsText(3)
outCS = arcpy.SpatialReference(spatial_ref)
. This uses the variable, not a string that happens to be the variable name.print outCS
after you get that 4th parameter as text so that you (and we) can see what a test value is that you enter.