I always use arcpy.GetParameterAsText to get the spatial reference from the user. There should be a way to decide what is the spatial reference of a shapefile but I can't find it. Something like Describe....

SR = arcpy.Describe(inFC).spatialReference

where inFC is an input shapefile or feature class. It returns a SpatialReference object.

  • Jason...The superfluous code was designed to be informative for the OP who doesn't appear to have much experience with the Describe object...I would wish that you returned it – user681 Aug 29 '13 at 22:55
  • I think the edit was appropriate. I am not sure what the other code demonstrates, but it does not seem to be relevant to the question at hand. – blah238 Aug 29 '13 at 23:07
  • 1
    Thirty years teaching down the drain :) it is amazing what someone can get out of a code snippet – user681 Aug 29 '13 at 23:24

if you want to spell out the name of the Spatial reference for feature class fc, use:

# Get spatial reference of the feature class
spatialRef = arcpy.Describe(fc).SpatialReference

# print the spatial reference
print spatialRef.Name

Printing only the spatialRef (without .Name at the end) prints only

print spatialRef
<geoprocessing spatial reference object object at 0x06623080>


print spatialRef.Name

returns the name of CS:


(based on GIS Programming and Automation class: https://www.e-education.psu.edu/geog485/node/115 )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.