Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

i am using arcgis server 10 and python 2.6.5.

i have created a "test.lyr" file, now i wanted to convert it either to shape file or raster file. i have created the "test.lyr" from "test0.tif" and added symbology from "test0.lyr" files as follows.


the curFile in the above code is the test.lyr file obtained. can anyone plz show how to convert it to "test1.shp" or "test1.tif" file using arcpy?

thanks a lot in advance.

share|improve this question

2 Answers 2

You can use the Feature Class to Shapefile geoprocessing tool to convert a lyr to a shp (see code example below).

BASEMAP_LOADER_Counties_lyr = "C:\\Temp\\BASEMAP.LOADER.Counties.lyr"
Temp__2_ = "C:\\Temp"

# Process: Feature Class To Shapefile (multiple)...
gp.FeatureClassToShapefile_conversion("C:\\Temp\\BASEMAP.LOADER.Counties.lyr", Temp__2_)

And you can use the Feature to Raster tool to convert a lyr to raster (see code sample below).

Feature_2_tif = "C:\\Temp\\Feature_2.tif"
BASEMAP_LOADER_Counties_lyr__2_ = "C:\\Temp\\BASEMAP.LOADER.Counties.lyr"

# Process: Feature to Raster...
gp.FeatureToRaster_conversion(BASEMAP_LOADER_Counties_lyr__2_, "OBJECTID", Feature_2_tif, "4832.40368")
share|improve this answer
hi both arcpy.FeatureClassToShapefile_conversion and arcpy.FeatureToRaster_conversion did not work... –  thm Aug 1 '11 at 12:10
in most of the cases it says: The value is not a Feature Layer. i opened my a.lyr file with arcmap 10, it shows everything fine... –  thm Aug 1 '11 at 12:21
for the shapefile conversion exactly it says the following: ExecuteError: Failed to execute. Parameters are not valid. ERROR 000840: The value is not a Feature Layer. Failed to execute (FeatureClassToShapefile). –  thm Aug 1 '11 at 12:24
@thm, My two examples were from using ArcGIS 9.3.1. What happens if you try another different lyr using both tools, same error? –  artwork21 Aug 1 '11 at 14:49

I'm not sure if it helps, but this is from the arcgis docs

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.