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?
-
Possibly try retrieving the GCS from the spatialreference and then check its name against the original?mkennedy– mkennedy2014年11月25日 23:13:09 +00:00Commented Nov 25, 2014 at 23:13
-
If I can make a suggestion, forcing users to look up WKID references can only lead to them disliking the tool. I'm a big fan of using set lists - data type MultiValue with options being set semicolon delimited in human readable form then reference these return values against SRIDs when setting the spatial reference... Although there are A LOT of valid spatial references generally users will stick to less than a dozen around where they mostly work, which is a manageable list.Michael Stimson– Michael Stimson2014年11月26日 00:35:22 +00:00Commented Nov 26, 2014 at 0:35
1 Answer 1
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
Explore related questions
See similar questions with these tags.