Working in Pro 2.7.3. Built a model that runs, minimum bounding geometry, mean center, adds geometry attributes, extracts the latitude and longitude, and then using the coordinates calculates the UTM zone using the calculate value tool. I have set the return data type to both spatial reference and coordinate system and am able to make a valid connection in my model to the project tool setting the output coordinate system parameter, and get the correct UTM parameter returned, but when the project tool runs, I get the error.
ERROR 000735: Output Coordinate System: Value is required
So for some reason the project tool is not recognizing what calculate value is returning.
It appears to be a bug with defining spatial references in arcpy. I am running Pro 2.7.3 and getting the following when run in the python window:
sr = arcpy.SpatialReference("WGS 1984 UTM Zone 10N") print(sr.name) WGS_1984_UTM_Zone_10N sr = arcpy.SpatialReference("WGS 1984 UTM Zone 6S") Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\arcobjects\mixins.py", line 942, in __init__ self._arc_object.createFromFile(item, vcs) RuntimeError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
The error appears to be happening with all the single digit zone numbers for both north and south. Can anyone else replicate this result or show it's working on an older version?
I have created a post in Python questions to get some more visibility on the issue:
After stuffing around with your model for way too long, I will have to admit defeat. I have got it to run successfully in the modelbuilder edit window. They key is to set the data type of the Calculate Value tool to Spatial Reference but just output the string eg: "WGS 1984 UTM Zone 10S" and not use arcpy to output an actual spatial reference. The project tool seems to take that as the output coordinate system just fine.
However I cannot make it work when running the model directly from a toolbox. I think there is just some sort of fundamental limitation of trying to programmatically define an output coordinate system at runtime via models.
I now remember why modelbuilder sucks so much. I recommend you create a python toolbox script instead to achieve what you are trying to do.
If I add exportToString to the return statement as below:
return arcpy.SpatialReference("WGS 1984 UTM Zone " + utm_zone).exportToString()
and change the data type to coordinate system and run the model within model builder first to return a value value and then connect it to the Project tool it works. It's been a while, but I seem to remember this from when building models in ArcMap. And I found it very annoying.
I am now dealing with an issue where I added variable to the model to use as the output workspace location. I am trying to add inline variables in the output dataset parameter and when I enter it and hit OK it prepends the the default workspace location to my inline variable. I just want the variable. So if I set the parameter to
%Feature Dataset%\%Input Layer%_Projected
after I it OK it changes to
C:\Users\luke\Documents\ArcGIS\Projects\SS\%Feature Dataset%\%Input Layer%_Projected
I don't want C:\Users\luke\Documents\ArcGIS\Projects\SS\ as that is defined in my variable "Feature Dataset"