<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create feature class in project folder directory in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299313#M67971</link>
    <description>&lt;P&gt;and you might want to add a *.shp to the output filename since the destination appears to be a folder&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jun 2023 17:33:03 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2023-06-14T17:33:03Z</dc:date>
    <item>
      <title>Create feature class in project folder directory</title>
      <link>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299187#M67965</link>
      <description>&lt;P&gt;I am trying to create an empty feature class in the projects folder directory, but I get the following error.&lt;/P&gt;&lt;P&gt;How can use arcpy.management.CreateFeatureclass to create an empty feature class in the projects folder?&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import arcpy
import os, sys
import time

from arcpy import env

t1 = time.time()

aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps()[0]
lyr = m.listLayers("Soil")[0]


arcpy.env.workspace = os.path.dirname(aprx.filePath)
wp = os.path.dirname(aprx.filePath)

outPath = wp
NewLyr = "Soils_New"
template = "Soil"

out_fc = arcpy.management.CreateFeatureclass(outPath, NewLyr, template)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Traceback (most recent call last):
  File "&amp;lt;string&amp;gt;", line 20, in &amp;lt;module&amp;gt;
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 3451, in CreateFeatureclass
    raise e
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 3448, in CreateFeatureclass
    retval = convertArcObjectToPythonObject(gp.CreateFeatureclass_management(*gp_fixargs((out_path, out_name, geometry_type, template, has_m, has_z, spatial_reference, config_keyword, spatial_grid_1, spatial_grid_2, spatial_grid_3, out_alias), True)))
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in &amp;lt;lambda&amp;gt;
    return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 160142: The Field type is invalid or unsupported for the operation.
Failed to execute (CreateFeatureclass).&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 14 Jun 2023 14:42:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299187#M67965</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2023-06-14T14:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create feature class in project folder directory</title>
      <link>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299210#M67966</link>
      <description>&lt;P&gt;Currently you have your template in the geometry_type parameter space.&lt;/P&gt;&lt;P&gt;Try either of the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;outPath = wp
NewLyr = "Soils_New"
templateFC = "Soil"

out_fc = arcpy.management.CreateFeatureclass(outPath, NewLyr, template = templateFC)

#OR 
out_fc = arcpy.management.CreateFeatureclass(outPath, NewLyr, "", templateFC)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-feature-class.htm" target="_blank" rel="noopener"&gt;Create Feature Class (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Editing to explain farther:&lt;/P&gt;&lt;P&gt;arcpy.management.CreateFeatureclass(out_path, out_name, {geometry_type}, {template}, {has_m}, {has_z}, {spatial_reference}, {config_keyword}, {spatial_grid_1}, {spatial_grid_2}, {spatial_grid_3}, {out_alias})&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each parameter in brackets is optional. The order still matters, so you have to account for them (example 2) UNLESS you specifically call each one(example 1)&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 15:01:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299210#M67966</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2023-06-14T15:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Create feature class in project folder directory</title>
      <link>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299313#M67971</link>
      <description>&lt;P&gt;and you might want to add a *.shp to the output filename since the destination appears to be a folder&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 17:33:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299313#M67971</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-06-14T17:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create feature class in project folder directory</title>
      <link>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299365#M67972</link>
      <description>&lt;P&gt;The soils layer resides in an SDE feature class/ feature dataset and I have other shapefiles and SDE feature classes in this project. No matter what sde feature class I changed the templateFC to, if it's in a feature class I get the error I posted. It works fine if the templateFC is a shapefile...?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 18:58:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299365#M67972</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2023-06-14T18:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Create feature class in project folder directory</title>
      <link>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299382#M67973</link>
      <description>&lt;P&gt;I'm not sure what to tell you, that error that you posted before specifically relates to an error in what you gave it for parameters. Is it possible it's giving you a different error?&lt;/P&gt;&lt;P&gt;I just tested myself on a feature class in an enterprise gdb (accessed through an SDE file) and it worked fine.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 19:45:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299382#M67973</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2023-06-14T19:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create feature class in project folder directory</title>
      <link>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299386#M67974</link>
      <description>&lt;P&gt;One thing else to check is that you're using a feature class as the template, not a feature dataset.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 19:49:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299386#M67974</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2023-06-14T19:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create feature class in project folder directory</title>
      <link>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299768#M67978</link>
      <description>&lt;P&gt;After testing and testing, I figured out why I kept getting that error, at least I think.&lt;/P&gt;&lt;P&gt;You have to be the owner/creator of that of that enterprise SDE gdb. The soils feature class was from another departments enterprise SDE gdb. It works on my enterprise SDE gdb but if the template is from another enterprise SDE gdb not owned or created by you it won't work. I've tested this a dozen times, that is how it functions for me.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 15:34:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-feature-class-in-project-folder-directory/m-p/1299768#M67978</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2023-06-15T15:34:57Z</dc:date>
    </item>
  </channel>
</rss>

