0

Not sure what I am doing wrong. Keep getting this error:

Exception has occurred: Execute Error ERROR 000622: Parameters are not valid ERROR 000628: Cannot set input into parameter Coordinate_System

Code:

import arcpy
from arcpy import env

env.workspace = r"C:\PSP\WeeklyWork\Week10\ArcPyAutomation\AutomationData\CANADA"

in_features = "lakes.shp"

properties = "PERIMETER_LENGTH_GEODESIC"

length_unit = "KILOMETERS"

coordinate_system = arcpy.SpatialReference("Projected Coordinate 
System/Continental/North America/Canada_Lambert_Conformal_Conic")

arcpy.AddGeometryAttributes_management(in_features, properties, length_unit, "", coordinate_system)
1

I think you are calling the SpatialReference incorrectly. Try doing it either as:

Just the code:

arcpy.SpatialReference(102002)

or just the name:

arcpy.SpatialReference("Canada_Lambert_Conformal_Conic")

or the filepath to a PRJ ensuring you include the extension:

arcpy.SpatialReference("C:\\My_Coords_Folder\\Canada_Lambert_Conformal_Conic.prj")

Refs: https://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/spatialreference.htm https://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/pdf/projected_coordinate_systems.pdf

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.