[GIS] Checking whether Spatial Reference is Projected Coordinate System using ArcPy

arcgis-10.1arcpycoordinate systemvector-grid

I'm modifying CreateFishnet in ArcGIS 10.1 using python.. I want to ask the user to input a projected coordinate as spatial reference.

How can I check if the user didn't put geographic coordinate by mistake?

I have one idea that,i will ask the user to put WKID as reference to input coordinate. In that case I can check whether that is a projected coordinate.
But, if i make a tool with that script, i can use GetParamterAsText function and set the value as 'spatial referecne'. In this case, user will select coordinate from Geographic/Projected coordinate folder.

How can I make sure that a projected coordinate is chosen in this case?

Best Answer

To determine whether an arcpy SpatialReference object is projected or geographic use the property type:

geoSR = arcpy.SpatialReference(4326)
print geoSR.type
Geographic

projSR = arcpy.SpatialReference(28356)
print projSR.type
Projected