Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using python, arctoolbox and arcpy 10.0

I am running a script that is tied to an arctoolbox. The toolbox serves to enter in my parameters. I have a feature layer as an input. The feature layer has the .dbf, .prj. shp, etc files.

I am trying to create an output shapefile. The output toolbox parameter is a shapefile. It generates a .shp, .xml, .dbf, but NOT a .prj file

I tried the following code to get the .prj file from my input file to also be included in the output file.

# Toolbox Parameters
# Gets input file
_in_polyline_m_layer = arcpy.GetParameterAsText(0)
_ResultFile = arcpy.GetParameterAsText(6)

spatial_reference = arcpy.Describe(_in_polyline_m_layer).spatialReference
# Creating my output file
arcpy.CreateFeatureclass_management(out_path, out_name, 'POLYGON', spatial_reference)

I keep getting this error: Error 000623: Invalid value type for parameter template. Not sure if the problem is within my script or in the actual toolbox. Any ideas or suggestions would be greatly appreciated. THanks in advance

share|improve this question
As a suggestion you could print out the contents of your spatial_reference variable, and compare it to what Copy As Python Snippet (from Geoprocessing | Results) gives when you do your Create Feature Class manually. – PolyGeo Mar 21 '13 at 22:57

You might want to try converting your spatial reference object to a string. Try adding the exportToString() method like so:

spatial_reference = arcpy.Describe(_in_polyline_m_layer).spatialReference.exportToString()

If you get an error, you may need to write exporttostring() in lower case rather than camel case (despite what's shown in the ArcGIS online help).

Hope that helps.

share|improve this answer

I have found the problem. The line of code to create a shapefile:

arcpy.CreateFeatureclass_management(out_path, out_name, 'POLYGON', spatial_reference)

also takes optional parameters. My spatial_reference parameter was in the wrong order. I was missing some parameters. The correct line of code should be:

arcpy.CreateFeatureclass_management(out_path, out_name, 'POLYGON', "","","",spatial_reference)

By adjusting the code in my previous post above to include the changed line of code, upon creating my shapefile, the porjection file is created as well.

share|improve this answer

I'm not sure about doing this in Arc, but in python I would use gdal_info to retrieve projection information and just copy this to a file with the .prj extension.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.