dimanche 30 novembre 2014

How to get the layer name with a arcpy code


Using the FeatureToPoint tool I've having difficulty calling just the name for file without the extension or path. Here is the part of the script that I'm creating that Im stuck on.


eg. C:\user\shapefiles\polygon.shp I just want the word polygon



import arcpy

file1 = arcpy.GetParameterAsText(1) # this is a .shp file
savepointlocation = arcpy.GetParameterAsText(2)

arcpy.FeatureToPoint_management(file1, save1, "INSIDE")


The problem is that its calling for the path of C:\user\shapefiles\polygon.shp and not just the name polygon.


I'm new and I'm sure there is some function or way to just call the name of the file without the path or the .shp in the file.





Aucun commentaire:

Enregistrer un commentaire