I decided to re-project shapefiles from one coordinate system to another. I wrote the following script but am getting the execution Error 999999.

Here is the script:

enter image description here

import arcpy

# input data is in NAD 1983 UTM Zone 11N coordinate system
Input_Elk_Feature = "C:\Temp\Data\Originals\Elk\ds945.shp"
Input_ElkHuntZones_Feature = "C:\Temp\Data\Originals\Elk\ds786.shp"

# output data
Output_Elk_Feature = "C:\Temp\Projected_Data"
Output_ElkHuntZones_Feature = "C:\Temp\Projected_Data"

# create a spatial reference object for the output coordinate system
Out_coordinate_system = arcpy.SpatialReference('NAD 1983 UTM Zone 10 North')

# run the tool
arcpy.Project_management(input_features, output_feature_class, out_coordinate_system) #reprojects the data into the specified coordinate system.

TestList = ["C:\Temp\Data\Originals\Elk\ds945.shp", "C:\Temp\Data\Originals\Elk\ds786.shp"]


while x>=0:
    Input_Elk_Feature = TestList[0]
    Output_Elk_Feature = "C:\Temp\Projected_Data"+0+".shp"
    arcpy.Project_management(input_features, output_feature_class, out_coordinate_system)


    Input_ElkHuntZones_Feature = TestList[1]
    Output_ElkHuntZones_Feature = "C:\Temp\Projected_Data"+1+".shp"
  • 1
    Welcome to GIS SE! As a new user be sure to take the Tour to learn about our focussed Q&A format. Please provide your code snippet and the error message that results from it as text rather than a picture so that it is available for searching and testing, and is easy to view on any device. There is an edit button beneath your question which will enable you to do that and a {} button that enables you to format any highlighted text nicely. – PolyGeo Apr 22 '17 at 23:01
  • In python all your paths should be prefixed with an r - r"C:\Temp\Data" or use double slash "C:\\Temp\\Data" to avoid errors with python trying to use your folder names – Midavalo Apr 22 '17 at 23:42
  • Also I'm not sure what you're trying to do with the while loop at the end, but it will never exit that loop as x is always equal to or greater than 0. – Midavalo Apr 22 '17 at 23:43

The clue is in the error message:

e "U:\GSP318\Project\Reproject.py", line 13, in <module>
Out_coordinate_system = arcpy.SpatialReference('NAD 1983 UTM Zone 10 North')

Your script is failing on the line setting the Spatial Reference. At a guess it is the word North - usually these are written more like NAD 1983 UTM Zone 10N. A quick test confirms it for me:

>>> sr = arcpy.SpatialReference('NAD 1983 UTM Zone 10 North')
Runtime error 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\arcobjects\mixins.py", line 992, in __init__
    self._arc_object.createFromFile(item, vcs)
RuntimeError: ERROR 999999: Error executing function.
>>> sr = arcpy.SpatialReference('NAD 1983 UTM Zone 10N')
>>> print sr.name

Change line 13 to be

Out_coordinate_system = arcpy.SpatialReference('NAD 1983 UTM Zone 10N')

and your script should proceed past this line.

FYI I usually try to determine the SR projection code and use that when I set a Spatial Reference variable:

Out_coordinate_system = arcpy.SpatialReference(26910)

Esri provide a PDF in the ArcGIS folder (mine is located at C:\Program Files (x86)\ArcGIS\Desktop10.5\Documentation\projected_coordinate_systems.pdf) with coordinate systems that includes the codes, or you can get them from SpatialReference.org

| improve this answer | |

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.