4

I am trying to create a feature class in memory but I am not sure how to use the syntax.

My code looks like this:

FC = arcpy.CreateFeatureclass_management("", "in_memory/FC", "POLYGON", "", "DISABLED",
                                         "DISABLED", Coordinate_System, "", "0", "0", "0")

Basically I seem to have problem defining the "out_path".

2 Answers 2

7

I realized what was wrong. See the correct code here:

FC = arcpy.CreateFeatureclass_management("in_memory", "FC", "POLYGON", "", "DISABLED", "DISABLED", Coordinate_System, "", "0", "0", "0")
3
  • Accept your answer with the checkbox!
    – Bera
    Commented Jun 7, 2019 at 8:30
  • Arash. That's great you got it to work! I am trying to figure out the in_memory workflow as well. I am confused in this response and logan's link to the arcpy documentation on the arguments in arcpy.CreateFeatureClass_management(). Where do I pass my file path? It seems "FC" is the desired feature layer name, but where am I passing for instance fp = 'path/to/feature_class'? Commented Jun 9, 2020 at 14:38
  • The first parameter is the output location. If you're not using a memory workspace, your path would replace "in_memory" in the above code.
    – BlueTalon
    Commented Dec 2, 2021 at 1:32
1

According to the document working with in memory workspace in arcmap office site. the code below should work, tested in arcmap 10.3:

memory_fc = arcpy.CreateFeatureclass_management("in_memory", "feat", "Polygon")
memory_fc_path = memory_fc[0] # this is the path of the featureclass created .

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.