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?

  • Possibly try retrieving the GCS from the spatialreference and then check its name against the original? – mkennedy Nov 25 '14 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 Nov 26 '14 at 0:35
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

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.