What is the Python script for shapefile to layer conversion? I tried the following...
import arcpy from arcpy import env env.workspace="working path" arcpy.MakeFeatureLayer_conversion("source shapefile", "target name")
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
This should work...
import arcpy from arcpy import env env.workspace = "G:/gis/test" dataset = arcpy.GetParameterAsText(0) lyr = r'Path To output location' # e.g. r'C:\Mapping\IndiaLyr.Lyr' arcpy.MakeFeatureLayer_management(dataset, "indlyr") arcpy.SaveToLayerFile_management("indlyr", lyr, "ABSOLUTE")
Edited to accomodate script tool solution. You can probably get rid of the env.workspace variable as it won't be used.
Once you create the script tool from your script, right click the script tool and select properties.
Give your script tool a name...
Click the Parameters tab, give your input parameter a Display Name and select the data type you would like to use (if you expect to either use a shapefile, feature class, etc. use the Dataset data type)
Click finish. Now open your script tool by double clicking it or right clicking and selecting open. Browse or drag and drop your dataset.