1

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?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Nov 25, 2014 at 23:05
2
  • Possibly try retrieving the GCS from the spatialreference and then check its name against the original? Commented 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. Commented Nov 26, 2014 at 0:35

1 Answer 1

4

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
answered Nov 25, 2014 at 23:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.