Calculate UTM Zone (Cartography) assigns a UTM zone to each feature within a feature class as a field value. The value returned is a 'UTM spatial reference string', which is a long string that looks something like this:
PROJCS["GCS North American 1983 UTM Zone 10S (Calculated)",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-123.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
I'd like to use this information to create a spatial reference object in the projection indicated in the UTM spatial reference string. I'm not sure how to go about this, however. It looks like parsing out a value in between the brackets after PROJCS would get me close. However, given the different format of the string (spaces vs underscores, etc.) I'm not sure how reliably I'd be able to get it to work anyways. Is there a better way to get a spatial reference object that each feature falls within?
Maybe there's a better way to get UTM zone per feature, but I would like the code to stand alone and not require a UTM Zone feature class to function.