Select to view content in your preferred language

ReProject Error In Script

1580
6
Jump to solution
04-07-2013 08:06 PM
ChristopherClark1
Deactivated User
At the end of a script I run a Projection, but I keep getting the following Error

PYTHON ERRORS:
Traceback info:
File "G:\Scripts\BARRIER_MERGE_edits.py", line 48, in <module>
arcpy.Project_management(GRADIENT_BAR_PT, GRADIENT_BARH83, outCS, CSTRANS)

Error Info:
ERROR 000622: Failed to execute (Project). Parameters are not valid.
ERROR 000628: Cannot set input into parameter out_coor_system.

Here is a piece of the script and the defined variables:

outCS = "NAD_1983_HARN_StatePlane_Washington_South_FIPS_4602_Feet"
CSTRANS = '"NAD_1927_To_NAD_1983_NADCON", "NAD_1983_To_HARN_WA_OR"'

arcpy.Project_management(GRADIENT_BAR_PT, GRADIENT_BARH83, outCS, CSTRANS)


Any ideas on where I am going wrong here? I appreciate the help!!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
If you are using 10.1, you supply the coordinate systems differently.  Instead of using a reference to the prj file (the folder is no longer there), you can use the WKID for the output coordinate system.  In this case the factory code for the State Plane South HARN is 2927.  You can create a spatial reference object but I have found that you can get it to work by just supplying the WKID.

CSTRANS = '"NAD_1927_To_NAD_1983_NADCON", "NAD_1983_To_HARN_WA_OR"' # WKID is 2927  arcpy.Project_management(GRADIENT_BAR_PT, GRADIENT_BARH83, 2927, CSTRANS)

View solution in original post

0 Kudos
6 Replies
by Anonymous User
Not applicable
If you are using 10.1, you supply the coordinate systems differently.  Instead of using a reference to the prj file (the folder is no longer there), you can use the WKID for the output coordinate system.  In this case the factory code for the State Plane South HARN is 2927.  You can create a spatial reference object but I have found that you can get it to work by just supplying the WKID.

CSTRANS = '"NAD_1927_To_NAD_1983_NADCON", "NAD_1983_To_HARN_WA_OR"' # WKID is 2927  arcpy.Project_management(GRADIENT_BAR_PT, GRADIENT_BARH83, 2927, CSTRANS)
0 Kudos
ArkadiuszMatoszka
Frequent Contributor
Hi,
outCS = "NAD_1983_HARN_StatePlane_Washington_South_FIPS_4602_Feet"

Is not a string representation of CS. Use Spatial Reference object instead i.e. supposing you're using arcmap 10.1:
arcpy.SpatialReference("NAD_1983_HARN_StatePlane_Washington_South_FIPS_4602_Feet")

or
arcpy.SpatialReference(2927)


Cheers.
Arek
0 Kudos
ChristopherClark1
Deactivated User
I have changed the code to :

arcpy.Project_management(GRADIENT_BAR_PT, GRADIENT_BARH83, 2927, CSTRANS)

But I get this error now :

Error Info:
Failed to execute. Parameters are not valid.
ERROR 000365: Invalid geographic transformation.
Failed to execute (Project).

The variable that is my Geographic transformation is

CSTRANS = '"NAD_1927_To_NAD_1983_NADCON", "NAD_1983_To_HARN_WA_OR"'

And it works in when I use that transformation in the tool, so I think it is a syntax error, or just a format error. Those are the correct transformations maybe I have just entered them wrong somehow?

THanks for the 2927 tip, I had no idea!
0 Kudos
MathewCoyle
Honored Contributor
I believe this is the correct syntax.

CSTRANS = '"NAD_1927_To_NAD_1983_NADCON + NAD_1983_To_HARN_WA_OR"'
0 Kudos
by Anonymous User
Not applicable
Yeah in the help docs they say you need to create the spatial reference object first, but I found out you can just supply the WKID without creating the SR object first and it seems to project it properly.  As for the transformation error, I would maybe take that parameter out and see if it works.  It *should* automatically do the proper transformation from the NAD 27 to NAD 83.
0 Kudos
ChristopherClark1
Deactivated User
Thanks MZCOYLE. That was in fact the correct Syntax.

Learning something new everyday I work with python.
0 Kudos