Hello all!
So I am really new to Python.
I had to convert a Matlab Script into Python script in order to be able to add it as a script tool in Arcmap.
I am having a hard time figuring out how to input a shapefile into my script. My whole script runs based on the shapefile so I have no way of checking if it works unless it reads the shapefile.
Thanks in advance!!
If you run the script standalone, then you just use the path to the ".shp" file like this:import arcpy
inputShp = r'C:\Path\to\some\shapefile.shp'
outputShp = r'C:\Path\to\other\shapefile.shp'
# do something with the shapefile
arcpy.CopyFeatures_management(inputShp, outputShp)
If you added the script to a Toolbox and the shapefile is a parameter, define the parameter as shapefile and read it from the script like:
import arcpy
inputShp = arcpy.GetParameterAsText(0)
# do something with the shapefile
If this is not what you're looking for then share the code and we can have a look at it.Kind regards,Xander