I have been given the task of taking a script that was made by someone who has left and altering where it saves the files. This is originally a simple folder system but we are moving over to file geodatabases. When executing the script I get the following message it tries to create a site boundary based on a shapefile created by user inputting easting and northings if a site boundary shp has not been provided.

This is the traceback error I am getting. the only thing I have added is to the os.pathjoin with what was previously the folder to the gdb variable that can be selected as parameter 8:

"Traceback (most recent call last): File "D:\Python Scripts\Scripts\Scripts\Tender GIS script Test .py", line 78, in arcpy.Buffer_analysis(inLocation, searchArea, studyAreaSize,"","","ALL") File "c:\program files (x86)\arcgis\desktop10.8\arcpy\arcpy\analysis.py", line 768, in Buffer raise e ExecuteError: ERROR 000210: Cannot create output D:\11111\GIS\Database\1111111_Project.gdb\10000_10000_StudyArea_.shp Failed to execute (Buffer)."

from arcpy.sa import *

#--- Tool input parameters ------------------------------------------------------------------------------
# siteBoundaryType = Site boundary type - Boundary/Coordinates (Value List String)
siteBoundaryType = arcpy.GetParameterAsText(0)
# inLocation = Site plan or points (Feature layer) - optional
inLocation = arcpy.GetParameterAsText(1)
# eastingIn = Coordinate option easting (String) - optional
eastingIn = arcpy.GetParameterAsText(2)
# northingIn = Coordinate option northing (String) - optional
northingIn = arcpy.GetParameterAsText(3)
# studyAreaSize = Study area buffer size (metres) (String)
studyAreaSize = arcpy.GetParameterAsText(4)
# siteName = Site name (String)
siteName = arcpy.GetParameterAsText(5)
# projectNumber = Project number (String)
projectNumber = arcpy.GetParameterAsText(6)
# GISFolder = Location of GIS folder (Folder)
GISFolder = arcpy.GetParameterAsText(7)
#GeodatabaseLocation - location of geodatabase (workspace)
gdb = arcpy.GetParameterAsText(8)
#Data Location - where to get the Data from (String)
dataFrom = arcpy.GetParameterAsText(9)

# --------------------------------------------------------------------------------------------------------

# --- Check out Spatial Analyst --------------------------------------------------------------------------
arcpy.env.overwriteOutput = True
# --------------------------------------------------------------------------------------------------------

#create set up folders for the working files-------------
workingVector = os.path.join(GISFolder, "VectorWorking")
workingRaster = os.path.join(GISFolder, "RasterWorking")

# Create folders
arcpy.CreateFolder_management(GISFolder, "VectorWorking")
arcpy.CreateFolder_management(GISFolder, "RasterWorking")

# Define British National Grid for new datasets ----------------------
bng = "PROJCS['British_National_Grid',GEOGCS['GCS_OSGB_1936',DATUM['D_OSGB_1936',SPHEROID['Airy_1830',6377563.396,299.3249646]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',400000.0],PARAMETER['False_Northing',-100000.0],PARAMETER['Central_Meridian',-2.0],PARAMETER['Scale_Factor',0.9996012717],PARAMETER['Latitude_Of_Origin',49.0],UNIT['Meter',1.0]]"
# --------------------------------------------------------------------
# Check input type - if a coordinate then create point ---------------
if siteBoundaryType == "Coordinates":
    point = arcpy.Point()
    pointGeometryList = []
    # Location from input X and Y
    point.X = eastingIn
    point.Y = northingIn
    # Create a point from XY
    pointGeometry = arcpy.PointGeometry(point)
    # Temporary point shapefile location
    tmpPointLocation = os.path.join(workingVector, "SitePoint.shp")
    # Create temporary point shapefile
    arcpy.CopyFeatures_management(pointGeometryList, tmpPointLocation)
    # Set as BNG
    arcpy.DefineProjection_management(tmpPointLocation, bng)
    # Set as site location
    inLocation = tmpPointLocation
# --------------------------------------------------------------------

# Check inLocation geometry type - is it a point, line or polygon? ---
inLocationGeometryDesc = arcpy.Describe(inLocation)
inLocationGeometry = inLocationGeometryDesc.shapeType
# --------------------------------------------------------------------

# Create study area -----------------------------------------------------------------
arcpy.AddMessage("Creating the study area")
arcpy.SetProgressorLabel("Creating the study area")
studyAreaPrefix = projectNumber + "_" + siteName + "_StudyArea"
searchArea =  os.path.join(gdb,(projectNumber + "_" + siteName + "_StudyArea_" + ".shp"))
# Buffer...#
arcpy.Buffer_analysis(inLocation, searchArea, studyAreaSize,"","","ALL")
arcpy.MakeFeatureLayer_management (searchArea, "searchArea_lyr")
    # ----------------------------------------------------------------```
  • 1
    A Featureclass name cannot have decimal points in their name so your output name should be 10000_10000_StudyArea_ not 10000_10000_StudyArea_.shp.
    – Hornbydd
    Jan 28, 2022 at 15:35

1 Answer 1


You're trying to stuff a shapefile into a geodatabase. And you can't do that. Additionally, you're starting the name with a number. It should start with a letter.

Per your code: searchArea = os.path.join(gdb,(projectNumber + "_" + siteName + "_StudyArea_" + ".shp")), the error makes sense: D:\11111\GIS\Database\1111111_Project.gdb\10000_10000_StudyArea_.shp

You need to pick, are you making .shp or classes in a gdb. The quickest way to get it to run is to remove the + '.shp' from the referenced code and add a letter in front of your "10000" (This appears to be coming from projectNumber, so the whole fix would look like: searchArea = os.path.join(gdb,("a_" + projectNumber + "_" + siteName + "_StudyArea_"))

  • Thanks @Khimba I have removed (why I didnt see that before) But now when I test it I am getting this error (change the name of things during the test) ERROR 000210: Cannot create output D:\11111\GIS\Database\New File Geodatabase.gdb\18881_hgfhfhf_StudyArea Failed to execute (Buffer) Jan 28, 2022 at 17:14
  • Now I think about it I think featureclass names should not start with a number?
    – Hornbydd
    Jan 28, 2022 at 17:34
  • Correct, dont start with a number. I'll add that into my answer
    – KHibma
    Jan 28, 2022 at 18:07
  • ahh that might cause an issue then as we use numbers to define the project it is on so we usually have ProjectNumber_ProjectName. I guess we could probably switch that around. Or if i converted it from featureclass to geodatabase that might work Jan 28, 2022 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.