I am using python to save the service area polygons from a Network Analyst layer file as shapefiles but the script fails to execute the copy features function:
ExecuteError: Failed to execute. Parameters are not valid; ERROR 000840: The value is not a Feature Layer; ERROR 000840: The value is not a Raster Catalog Layer; Failed to execute (CopyFeatures)
Can anyone tell me what is wrong with the script?
# Import module
import arcpy
import os
# Local variables:
layer_name = "FireStationCoverage"
FireStationCoverage_lyr = "C:/Data/FireStationCoverage.lyr"
Polygons = FireStationCoverage_lyr
output_dir = "C:/Data/poly_output"
out_featureclass = os.path.join(output_dir,layer_name)
# Process: Select Data
arcpy.SelectData_management(FireStationCoverage, "Polygons")
print "data selected"
# Process: Feature Class to Feature Class
arcpy.management.CopyFeatures(Polygons, out_featureclass)
print "data saved"