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 ArcGIS Desktop 10 and Python 2.6.5.

i have created a "test.lyr" file, now i want 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 show how to convert it to "test1.shp" or "test1.tif" file using arcpy?

share|improve this question

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

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.