Exporting feature class into multiple feature classes based on field values using ArcGIS Desktop?Single polygon shapefile to multiple polygon shapefilesSplitting feature class by unique values for an attribute/field in ArcGIS for Desktop?Dividing polygon layer into multiple layers by values in attribute table column using ArcGIS for Desktop?How to separate states in USA file using ArcGIS for Desktop?Export to SHP with ArcPy with queryCreating new feature classes from rows in polygon feature class?Automating Extract by Attribute using ArcGIS ModelBuilder?Iterating/looping through Select by Attributes and Export Data?Use python code to extract all attributes shapefilecreating many Shapefiles from from a single multi-polygonal shapefile using ArGIS toolsDeleting records from multiple, similar feature classes by attribute values using SQL statement in ArcGIS Desktop?Creating individual points from count field in point feature class using ArcGIS for Desktop?Create New Feature Class Based off Multiple Feature ClassesSimplifying a feature class to feature class ETL using multiple input feature classes with varied schemasCombining multiple feature classes into single feature class using ArcGIS for Desktop?Merging several feature classes into one pre-existing feature class in geodatabase with coded domains?Bulk Exporting Feature Classes Based on Field Name in ArcGIS Desktop?Appending multiple shapefiles into existing blank feature classes using ModelBuilder?Aligning or integrating features from two feature classes using ArcGIS Desktop?Exporting multiple feature classes with joined fields using ArcPy?

What is it called when one voice type sings a 'solo'?

What are the advantages and disadvantages of running one shots compared to campaigns?

What happens when a metallic dragon and a chromatic dragon mate?

Landing in very high winds

Is it wise to hold on to stock that has plummeted and then stabilized?

Manga about a female worker who got dragged into another world together with this high school girl and she was just told she's not needed anymore

How to manage monthly salary

extract characters between two commas?

Is domain driven design an anti-SQL pattern?

How to answer pointed "are you quitting" questioning when I don't want them to suspect

Shall I use personal or official e-mail account when registering to external websites for work purpose?

Copycat chess is back

Add an angle to a sphere

Doomsday-clock for my fantasy planet

"My colleague's body is amazing"

How would photo IDs work for shapeshifters?

Where else does the Shulchan Aruch quote an authority by name?

Finding files for which a command fails

Can I legally use front facing blue light in the UK?

What is the offset in a seaplane's hull?

Is there any use for defining additional entity types in a SOQL FROM clause?

Is there a way to make member function NOT callable from constructor?

Could Giant Ground Sloths have been a good pack animal for the ancient Mayans?

Calculate Levenshtein distance between two strings in Python



Exporting feature class into multiple feature classes based on field values using ArcGIS Desktop?


Single polygon shapefile to multiple polygon shapefilesSplitting feature class by unique values for an attribute/field in ArcGIS for Desktop?Dividing polygon layer into multiple layers by values in attribute table column using ArcGIS for Desktop?How to separate states in USA file using ArcGIS for Desktop?Export to SHP with ArcPy with queryCreating new feature classes from rows in polygon feature class?Automating Extract by Attribute using ArcGIS ModelBuilder?Iterating/looping through Select by Attributes and Export Data?Use python code to extract all attributes shapefilecreating many Shapefiles from from a single multi-polygonal shapefile using ArGIS toolsDeleting records from multiple, similar feature classes by attribute values using SQL statement in ArcGIS Desktop?Creating individual points from count field in point feature class using ArcGIS for Desktop?Create New Feature Class Based off Multiple Feature ClassesSimplifying a feature class to feature class ETL using multiple input feature classes with varied schemasCombining multiple feature classes into single feature class using ArcGIS for Desktop?Merging several feature classes into one pre-existing feature class in geodatabase with coded domains?Bulk Exporting Feature Classes Based on Field Name in ArcGIS Desktop?Appending multiple shapefiles into existing blank feature classes using ModelBuilder?Aligning or integrating features from two feature classes using ArcGIS Desktop?Exporting multiple feature classes with joined fields using ArcPy?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








32















I have a feature class with over 2,000 features, and I need to make them all individual feature classes based on a field.



Is there a way to do this?










share|improve this question



















  • 1





    And are you really sure that you need this 4178 shapefiles? Sounds like bad solution. Why are you need this?

    – Serge Norin
    Nov 9 '17 at 21:34











  • I agree with @SergeNorin. A definition query would be much easier, and have the same effect.

    – Bjorn
    Nov 9 '17 at 21:47











  • See @SergeNorin's linked answer, this is exactly what you're asking for. But that sounds a bit unnecessarily complex, you should probably go for either a simple definition query in your layer properties, or else an Iterator process or Search Cursor.

    – AlecZ
    Nov 9 '17 at 22:02

















32















I have a feature class with over 2,000 features, and I need to make them all individual feature classes based on a field.



Is there a way to do this?










share|improve this question



















  • 1





    And are you really sure that you need this 4178 shapefiles? Sounds like bad solution. Why are you need this?

    – Serge Norin
    Nov 9 '17 at 21:34











  • I agree with @SergeNorin. A definition query would be much easier, and have the same effect.

    – Bjorn
    Nov 9 '17 at 21:47











  • See @SergeNorin's linked answer, this is exactly what you're asking for. But that sounds a bit unnecessarily complex, you should probably go for either a simple definition query in your layer properties, or else an Iterator process or Search Cursor.

    – AlecZ
    Nov 9 '17 at 22:02













32












32








32


11






I have a feature class with over 2,000 features, and I need to make them all individual feature classes based on a field.



Is there a way to do this?










share|improve this question
















I have a feature class with over 2,000 features, and I need to make them all individual feature classes based on a field.



Is there a way to do this?







arcgis-desktop select-by-attribute split-by-attribute






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 14 '18 at 20:05









PolyGeo

53.9k1781245




53.9k1781245










asked May 19 '11 at 22:32









SophieSophie

163124




163124







  • 1





    And are you really sure that you need this 4178 shapefiles? Sounds like bad solution. Why are you need this?

    – Serge Norin
    Nov 9 '17 at 21:34











  • I agree with @SergeNorin. A definition query would be much easier, and have the same effect.

    – Bjorn
    Nov 9 '17 at 21:47











  • See @SergeNorin's linked answer, this is exactly what you're asking for. But that sounds a bit unnecessarily complex, you should probably go for either a simple definition query in your layer properties, or else an Iterator process or Search Cursor.

    – AlecZ
    Nov 9 '17 at 22:02












  • 1





    And are you really sure that you need this 4178 shapefiles? Sounds like bad solution. Why are you need this?

    – Serge Norin
    Nov 9 '17 at 21:34











  • I agree with @SergeNorin. A definition query would be much easier, and have the same effect.

    – Bjorn
    Nov 9 '17 at 21:47











  • See @SergeNorin's linked answer, this is exactly what you're asking for. But that sounds a bit unnecessarily complex, you should probably go for either a simple definition query in your layer properties, or else an Iterator process or Search Cursor.

    – AlecZ
    Nov 9 '17 at 22:02







1




1





And are you really sure that you need this 4178 shapefiles? Sounds like bad solution. Why are you need this?

– Serge Norin
Nov 9 '17 at 21:34





And are you really sure that you need this 4178 shapefiles? Sounds like bad solution. Why are you need this?

– Serge Norin
Nov 9 '17 at 21:34













I agree with @SergeNorin. A definition query would be much easier, and have the same effect.

– Bjorn
Nov 9 '17 at 21:47





I agree with @SergeNorin. A definition query would be much easier, and have the same effect.

– Bjorn
Nov 9 '17 at 21:47













See @SergeNorin's linked answer, this is exactly what you're asking for. But that sounds a bit unnecessarily complex, you should probably go for either a simple definition query in your layer properties, or else an Iterator process or Search Cursor.

– AlecZ
Nov 9 '17 at 22:02





See @SergeNorin's linked answer, this is exactly what you're asking for. But that sounds a bit unnecessarily complex, you should probably go for either a simple definition query in your layer properties, or else an Iterator process or Search Cursor.

– AlecZ
Nov 9 '17 at 22:02










15 Answers
15






active

oldest

votes


















39














You may use the Split By Attributes tool:




Splits an input dataset by unique attributes




There are versions available for:




  • ArcGIS Pro (available at all license levels)


  • ArcGIS Desktop 10.6 (available at all license levels)

  • USGS versions (Split By Attribute Tool)





share|improve this answer
































    22














    You can achieve this with a very simple model if you have ArcGIS 10.0 or higher.



    Create a model with Feature Iterator where the group by field is the attribute you wish to select by then send the output to the copy features tool using inline substitution to ensure a unique file name. The model is shown below:



    Model for extracting by attribute






    share|improve this answer























    • Perhaps I am novice with Model Builder (much better with Python) but I want to give this a shot... I keep running into the error that the table already exists. If I group features by an attribute, then output to that selected unique value, and use the variable in my output name, then what could I be doing wrong?

      – Stella
      Feb 18 '16 at 18:41











    • I would imagine it's the output name that is wrong,are you using inline substitution as shown in the image?

      – Hornbydd
      Feb 18 '16 at 18:47











    • is this tool is supported in Basic licence?

      – Losbaltica
      Jan 25 '17 at 14:09











    • You can build all that you can see in the model with a basic license.

      – Hornbydd
      Jan 25 '17 at 17:06


















    16














    I do not have access to ArcMap 10, only 9.3, but I expect that it won't be very different from this.



    You can create a simple script in Python, that checks your attribute field for different values, and then, for each of them runs a SELECT operation to your original Shapefile.



    If you are not familiar with python scripting, all you need to do is open you IDLE (the python GUI) create a new file, and copy the code below. After adapting the code for your my_shapefile, outputdir and my_attribute it should work.



    # Script created to separate one shapefile in multiple ones by one specific
    # attribute

    # Example for a Inputfile called "my_shapefile" and a field called "my_attribute"
    import arcgisscripting

    # Starts Geoprocessing
    gp = arcgisscripting.create(9.3)
    gp.OverWriteOutput = 1

    #Set Input Output variables
    inputFile = u"C:\GISTemp\My_Shapefile.shp" #<-- CHANGE
    outDir = u"C:\GISTemp\" #<-- CHANGE

    # Reads My_shapefile for different values in the attribute
    rows = gp.searchcursor(inputFile)
    row = rows.next()
    attribute_types = set([])

    while row:
    attribute_types.add(row.my_attribute) #<-- CHANGE my_attribute to the name of your attribute
    row = rows.next()

    # Output a Shapefile for each different attribute
    for each_attribute in attribute_types:
    outSHP = outDir + each_attribute + u".shp"
    print outSHP
    gp.Select_analysis (inputFile, outSHP, ""my_attribute" = '" + each_attribute + "'") #<-- CHANGE my_attribute to the name of your attribute

    del rows, row, attribute_types, gp

    #END





    share|improve this answer
































      13














      Did you see Split Layer By Attributes tool updated for ArcMap 10 here? If it does not work you can use Split (Analysis) for your needs.




      Splitting the Input Features creates a subset of multiple output
      feature classes. The Split Field's unique values form the names of the
      output feature classes. These are saved in the target workspace.




      split



      Example Code:



      import arcpy
      arcpy.env.workspace = "c:/data"
      arcpy.Split_analysis("Habitat_Analysis.gdb/vegtype", "climate.shp", "Zone",
      "C:/output/Output.gdb", "1 Meters")





      share|improve this answer

























      • The built-in Split tool works great for your purposes if you create an extent rectangle the same size as your polygons you wish to split.

        – ccn
        Jan 31 '13 at 16:25











      • Unless I'm misreading the question I think it is asking for a "Split By Attribute" rather than a "Split By Location". Split (Analysis) provides "Split By Location" functionality. The comment by @ccn here offers an interesting workaround which could perhaps be edited in as a "clarification" to this answer.

        – PolyGeo
        Dec 3 '14 at 6:39











      • I worry that the question describes Split By Attribute functionality and your answer is mostly about Split [By Geometry].

        – PolyGeo
        Jul 27 '17 at 22:56


















      9














      I used Alexandre Neto's script and updated it for ArcGIS 10.x users. Mainly you now have to import "arcpy" instead of "arcgisscripting":



      # Script created to separate one shapefile in multiple ones by one specific
      # attribute

      # Example for a Inputfile called "my_shapefile" and a field called "my_attribute"
      import arcpy

      #Set Input Output variables
      inputFile = u"D:DXF-Exportmy_shapefile.shp" #<-- CHANGE
      outDir = u"D:DXF-Export\" #<-- CHANGE

      # Reads My_shapefile for different values in the attribute
      rows = arcpy.SearchCursor(inputFile)
      row = rows.next()
      attribute_types = set([])

      while row:
      attribute_types.add(row.my_attribute) #<-- CHANGE my_attribute to the name of your attribute
      row = rows.next()

      # Output a Shapefile for each different attribute
      for each_attribute in attribute_types:
      outSHP = outDir + each_attribute + u".shp"
      print outSHP
      arcpy.Select_analysis (inputFile, outSHP, ""my_attribute" = '" + each_attribute + "'") #<-- CHANGE my_attribute to the name of your attribute

      del rows, row, attribute_types

      #END





      share|improve this answer
































        6














        This is an even easier way to do this... and it outputs into a GDB.



        http://www.umesc.usgs.gov/management/dss/split_by_attribute_tool.html



        download the tool from USGS, took me 3 minutes to do what i had been trying for 1 hour.






        share|improve this answer























        • Thank you for the link! Works like a charm (and for version 10.2!)

          – WolverineTime
          Mar 26 '15 at 17:07











        • I tried this tool recently, and nothing happened when I executed it. I chose my feature, selected the field to select features by, selected an output location, hit OK and nothing happened. It just wouldn't "go"...am I missing something? Thanks!

          – rachel.passer
          May 28 '15 at 15:09


















        6














        I know you can use an iterator in model builder, but if you prefer to use python here is something I came up with. Add the script to a toolbox with the parameters in order as Input shpfile, fields(multivalue,obtained from input), and workspace. This script will split the shapefile into multiple shapefiles based on the fields you select, and output them into a folder of your choice.



        import arcpy, re

        arcpy.env.overwriteOutput = True

        Input = arcpy.GetParameterAsText(0)
        Flds = "%s" % (arcpy.GetParameterAsText(1))
        OutWorkspace = arcpy.GetParameterAsText(2)


        myre = re.compile(";")
        FldsSplit = myre.split(Flds)

        sort = "%s A" % (FldsSplit[0])
        rows = arcpy.SearchCursor(Input, "", "", Flds, sort)

        for row in rows:
        var = []
        for r in range(len(FldsSplit)):
        var.append(row.getValue(FldsSplit[r]))
        Query = ''
        Name = ''
        for x in range(len(var)):
        if x == 0:
        fildz = FldsSplit[x]
        Name = var[x] + "_"
        Query += (""" "%s" = '%s'""" % (fildz, var[x]))
        if x > 0:
        fildz = FldsSplit[x]
        Name += var[x] + "_"
        Query += (""" AND "%s" = '%s' """ % (fildz, var[x]))
        OutputShp = OutWorkspace + r"%s.shp" % (Name)
        arcpy.Select_analysis(Input, OutputShp, Query)





        share|improve this answer
































          6














          Split Dataset from GME is a free third-party tool that splits by attribute.






          share|improve this answer















          We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.





















            4














            I have eventually got it working with SearchCursor and Select_analysis



            arcpy.env.workspace = strInPath
            # create a set to hold the attributes
            attributes=set([])
            # ---- create a list of feature classes in the current workspace ----
            listOfFeatures = arcpy.SearchCursor(strInPath,"","",strFieldName,"")
            for row in listOfFeatures:
            attributes.add(row.getValue(strFieldName))
            count=1
            try:
            for row in attributes:
            stroOutputClass = strBaseName + "_" +str(count)# (str(row.getValue(strFieldName))).replace('/','_')
            strOutputFeatureClass = os.path.join(strOutGDBPath, stroOutputClass)
            arcpy.Select_analysis(strInPath,strOutputFeatureClass,strQueryExp)#"["+strFieldName+"]"+"='"+row+"'")
            count=count+1
            del attributes
            except:
            arcpy.AddMessage('Error found')





            share|improve this answer






























              3














              I'm not familiar with the Iterate Feature Selection tools in ModelBuilder, but exporting just that as Python code indicate that they can be called using arcpy.



               # Created on: 2015-05-19 15:26:10.00000
              # (generated by ArcGIS/ModelBuilder)
              # Description:
              # ---------------------------------------------------------------------------

              # Import arcpy module
              import arcpy

              # Load required toolboxes
              arcpy.ImportToolbox("Model Functions")


              # Local variables:
              Selected_Features = ""
              Value = "1"

              # Process: Iterate Feature Selection
              arcpy.IterateFeatureSelection_mb("", "", "false")





              share|improve this answer






























                3














                You can use a Search Cursor to loop through individual features in a feature class and write just the geometries to unique feature classes. In this example, I use a feature class of the USA and export the states to new shapefiles:



                import arcpy

                # This is a path to an ESRI FC of the USA
                states = r'C:Program Files (x86)ArcGISDesktop10.2TemplateDataTemplateData.gdbUSAstates'
                out_path = r'C:temp'

                with arcpy.da.SearchCursor(states, ["STATE_NAME", "SHAPE@"]) as cursor:
                for row in cursor:
                out_name = str(row[0]) # Define the output shapefile name (e.g. "Hawaii")
                arcpy.FeatureClassToFeatureClass_conversion(row[1], out_path, out_name)





                share|improve this answer

























                • I think the downside of this answer is that you do not carry through the attributes. I prefer an answer more like gis.stackexchange.com/a/152165/115 which will.

                  – PolyGeo
                  Sep 15 '16 at 22:52











                • Good point @PolyGeo, however, the upside is that this can be wrapped into other workflows that also require cursor operations.

                  – Aaron
                  Sep 16 '16 at 1:46











                • ... but so could using Select_analysis in place of FeatureClassToFeatureClass - it's only one line of code that would change.

                  – PolyGeo
                  Sep 16 '16 at 1:51


















                2














                You can use a geometry token (SHAPE@) within Copy Features (Data Management) to export each feature.



                import arcpy, os

                shp = r'C:tempyourSHP.shp'
                outws = r'C:temp'

                with arcpy.da.SearchCursor(shp, ["OBJECTID","SHAPE@"]) as cursor:
                for row in cursor:
                outfc = os.path.join(outws, "fc" + str(row[0]))
                arcpy.CopyFeatures_management(row[1], outfc)





                share|improve this answer
































                  2














                  In Arcpy, Cursors honor layer/TableView selections. According to Getting list of selected features in ArcGIS for Desktop using Python code?, you can simply iterate feature selections.



                  However if you want to make a selection using arcpy, use SelectLayerByAttribute_management tool.






                  share|improve this answer
































                    1














                    The "Split by Attributes" tool in the Analysis, Extract toolbox will create a new Shapefile for each unique value from the Field you select.






                    share|improve this answer
































                      0














                      You can use a searchcursor to select each row of your file and then use copy features to export it as an individual file.






                      share|improve this answer























                        Your Answer








                        StackExchange.ready(function()
                        var channelOptions =
                        tags: "".split(" "),
                        id: "79"
                        ;
                        initTagRenderer("".split(" "), "".split(" "), channelOptions);

                        StackExchange.using("externalEditor", function()
                        // Have to fire editor after snippets, if snippets enabled
                        if (StackExchange.settings.snippets.snippetsEnabled)
                        StackExchange.using("snippets", function()
                        createEditor();
                        );

                        else
                        createEditor();

                        );

                        function createEditor()
                        StackExchange.prepareEditor(
                        heartbeatType: 'answer',
                        autoActivateHeartbeat: false,
                        convertImagesToLinks: false,
                        noModals: true,
                        showLowRepImageUploadWarning: true,
                        reputationToPostImages: null,
                        bindNavPrevention: true,
                        postfix: "",
                        imageUploader:
                        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                        allowUrls: true
                        ,
                        onDemand: true,
                        discardSelector: ".discard-answer"
                        ,immediatelyShowMarkdownHelp:true
                        );



                        );













                        draft saved

                        draft discarded


















                        StackExchange.ready(
                        function ()
                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f9998%2fexporting-feature-class-into-multiple-feature-classes-based-on-field-values-usin%23new-answer', 'question_page');

                        );

                        Post as a guest















                        Required, but never shown

























                        15 Answers
                        15






                        active

                        oldest

                        votes








                        15 Answers
                        15






                        active

                        oldest

                        votes









                        active

                        oldest

                        votes






                        active

                        oldest

                        votes









                        39














                        You may use the Split By Attributes tool:




                        Splits an input dataset by unique attributes




                        There are versions available for:




                        • ArcGIS Pro (available at all license levels)


                        • ArcGIS Desktop 10.6 (available at all license levels)

                        • USGS versions (Split By Attribute Tool)





                        share|improve this answer





























                          39














                          You may use the Split By Attributes tool:




                          Splits an input dataset by unique attributes




                          There are versions available for:




                          • ArcGIS Pro (available at all license levels)


                          • ArcGIS Desktop 10.6 (available at all license levels)

                          • USGS versions (Split By Attribute Tool)





                          share|improve this answer



























                            39












                            39








                            39







                            You may use the Split By Attributes tool:




                            Splits an input dataset by unique attributes




                            There are versions available for:




                            • ArcGIS Pro (available at all license levels)


                            • ArcGIS Desktop 10.6 (available at all license levels)

                            • USGS versions (Split By Attribute Tool)





                            share|improve this answer















                            You may use the Split By Attributes tool:




                            Splits an input dataset by unique attributes




                            There are versions available for:




                            • ArcGIS Pro (available at all license levels)


                            • ArcGIS Desktop 10.6 (available at all license levels)

                            • USGS versions (Split By Attribute Tool)






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Aug 28 '18 at 11:45

























                            answered May 19 '11 at 22:35









                            artwork21artwork21

                            31.1k554120




                            31.1k554120























                                22














                                You can achieve this with a very simple model if you have ArcGIS 10.0 or higher.



                                Create a model with Feature Iterator where the group by field is the attribute you wish to select by then send the output to the copy features tool using inline substitution to ensure a unique file name. The model is shown below:



                                Model for extracting by attribute






                                share|improve this answer























                                • Perhaps I am novice with Model Builder (much better with Python) but I want to give this a shot... I keep running into the error that the table already exists. If I group features by an attribute, then output to that selected unique value, and use the variable in my output name, then what could I be doing wrong?

                                  – Stella
                                  Feb 18 '16 at 18:41











                                • I would imagine it's the output name that is wrong,are you using inline substitution as shown in the image?

                                  – Hornbydd
                                  Feb 18 '16 at 18:47











                                • is this tool is supported in Basic licence?

                                  – Losbaltica
                                  Jan 25 '17 at 14:09











                                • You can build all that you can see in the model with a basic license.

                                  – Hornbydd
                                  Jan 25 '17 at 17:06















                                22














                                You can achieve this with a very simple model if you have ArcGIS 10.0 or higher.



                                Create a model with Feature Iterator where the group by field is the attribute you wish to select by then send the output to the copy features tool using inline substitution to ensure a unique file name. The model is shown below:



                                Model for extracting by attribute






                                share|improve this answer























                                • Perhaps I am novice with Model Builder (much better with Python) but I want to give this a shot... I keep running into the error that the table already exists. If I group features by an attribute, then output to that selected unique value, and use the variable in my output name, then what could I be doing wrong?

                                  – Stella
                                  Feb 18 '16 at 18:41











                                • I would imagine it's the output name that is wrong,are you using inline substitution as shown in the image?

                                  – Hornbydd
                                  Feb 18 '16 at 18:47











                                • is this tool is supported in Basic licence?

                                  – Losbaltica
                                  Jan 25 '17 at 14:09











                                • You can build all that you can see in the model with a basic license.

                                  – Hornbydd
                                  Jan 25 '17 at 17:06













                                22












                                22








                                22







                                You can achieve this with a very simple model if you have ArcGIS 10.0 or higher.



                                Create a model with Feature Iterator where the group by field is the attribute you wish to select by then send the output to the copy features tool using inline substitution to ensure a unique file name. The model is shown below:



                                Model for extracting by attribute






                                share|improve this answer













                                You can achieve this with a very simple model if you have ArcGIS 10.0 or higher.



                                Create a model with Feature Iterator where the group by field is the attribute you wish to select by then send the output to the copy features tool using inline substitution to ensure a unique file name. The model is shown below:



                                Model for extracting by attribute







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Mar 16 '14 at 22:57









                                HornbyddHornbydd

                                27.1k32957




                                27.1k32957












                                • Perhaps I am novice with Model Builder (much better with Python) but I want to give this a shot... I keep running into the error that the table already exists. If I group features by an attribute, then output to that selected unique value, and use the variable in my output name, then what could I be doing wrong?

                                  – Stella
                                  Feb 18 '16 at 18:41











                                • I would imagine it's the output name that is wrong,are you using inline substitution as shown in the image?

                                  – Hornbydd
                                  Feb 18 '16 at 18:47











                                • is this tool is supported in Basic licence?

                                  – Losbaltica
                                  Jan 25 '17 at 14:09











                                • You can build all that you can see in the model with a basic license.

                                  – Hornbydd
                                  Jan 25 '17 at 17:06

















                                • Perhaps I am novice with Model Builder (much better with Python) but I want to give this a shot... I keep running into the error that the table already exists. If I group features by an attribute, then output to that selected unique value, and use the variable in my output name, then what could I be doing wrong?

                                  – Stella
                                  Feb 18 '16 at 18:41











                                • I would imagine it's the output name that is wrong,are you using inline substitution as shown in the image?

                                  – Hornbydd
                                  Feb 18 '16 at 18:47











                                • is this tool is supported in Basic licence?

                                  – Losbaltica
                                  Jan 25 '17 at 14:09











                                • You can build all that you can see in the model with a basic license.

                                  – Hornbydd
                                  Jan 25 '17 at 17:06
















                                Perhaps I am novice with Model Builder (much better with Python) but I want to give this a shot... I keep running into the error that the table already exists. If I group features by an attribute, then output to that selected unique value, and use the variable in my output name, then what could I be doing wrong?

                                – Stella
                                Feb 18 '16 at 18:41





                                Perhaps I am novice with Model Builder (much better with Python) but I want to give this a shot... I keep running into the error that the table already exists. If I group features by an attribute, then output to that selected unique value, and use the variable in my output name, then what could I be doing wrong?

                                – Stella
                                Feb 18 '16 at 18:41













                                I would imagine it's the output name that is wrong,are you using inline substitution as shown in the image?

                                – Hornbydd
                                Feb 18 '16 at 18:47





                                I would imagine it's the output name that is wrong,are you using inline substitution as shown in the image?

                                – Hornbydd
                                Feb 18 '16 at 18:47













                                is this tool is supported in Basic licence?

                                – Losbaltica
                                Jan 25 '17 at 14:09





                                is this tool is supported in Basic licence?

                                – Losbaltica
                                Jan 25 '17 at 14:09













                                You can build all that you can see in the model with a basic license.

                                – Hornbydd
                                Jan 25 '17 at 17:06





                                You can build all that you can see in the model with a basic license.

                                – Hornbydd
                                Jan 25 '17 at 17:06











                                16














                                I do not have access to ArcMap 10, only 9.3, but I expect that it won't be very different from this.



                                You can create a simple script in Python, that checks your attribute field for different values, and then, for each of them runs a SELECT operation to your original Shapefile.



                                If you are not familiar with python scripting, all you need to do is open you IDLE (the python GUI) create a new file, and copy the code below. After adapting the code for your my_shapefile, outputdir and my_attribute it should work.



                                # Script created to separate one shapefile in multiple ones by one specific
                                # attribute

                                # Example for a Inputfile called "my_shapefile" and a field called "my_attribute"
                                import arcgisscripting

                                # Starts Geoprocessing
                                gp = arcgisscripting.create(9.3)
                                gp.OverWriteOutput = 1

                                #Set Input Output variables
                                inputFile = u"C:\GISTemp\My_Shapefile.shp" #<-- CHANGE
                                outDir = u"C:\GISTemp\" #<-- CHANGE

                                # Reads My_shapefile for different values in the attribute
                                rows = gp.searchcursor(inputFile)
                                row = rows.next()
                                attribute_types = set([])

                                while row:
                                attribute_types.add(row.my_attribute) #<-- CHANGE my_attribute to the name of your attribute
                                row = rows.next()

                                # Output a Shapefile for each different attribute
                                for each_attribute in attribute_types:
                                outSHP = outDir + each_attribute + u".shp"
                                print outSHP
                                gp.Select_analysis (inputFile, outSHP, ""my_attribute" = '" + each_attribute + "'") #<-- CHANGE my_attribute to the name of your attribute

                                del rows, row, attribute_types, gp

                                #END





                                share|improve this answer





























                                  16














                                  I do not have access to ArcMap 10, only 9.3, but I expect that it won't be very different from this.



                                  You can create a simple script in Python, that checks your attribute field for different values, and then, for each of them runs a SELECT operation to your original Shapefile.



                                  If you are not familiar with python scripting, all you need to do is open you IDLE (the python GUI) create a new file, and copy the code below. After adapting the code for your my_shapefile, outputdir and my_attribute it should work.



                                  # Script created to separate one shapefile in multiple ones by one specific
                                  # attribute

                                  # Example for a Inputfile called "my_shapefile" and a field called "my_attribute"
                                  import arcgisscripting

                                  # Starts Geoprocessing
                                  gp = arcgisscripting.create(9.3)
                                  gp.OverWriteOutput = 1

                                  #Set Input Output variables
                                  inputFile = u"C:\GISTemp\My_Shapefile.shp" #<-- CHANGE
                                  outDir = u"C:\GISTemp\" #<-- CHANGE

                                  # Reads My_shapefile for different values in the attribute
                                  rows = gp.searchcursor(inputFile)
                                  row = rows.next()
                                  attribute_types = set([])

                                  while row:
                                  attribute_types.add(row.my_attribute) #<-- CHANGE my_attribute to the name of your attribute
                                  row = rows.next()

                                  # Output a Shapefile for each different attribute
                                  for each_attribute in attribute_types:
                                  outSHP = outDir + each_attribute + u".shp"
                                  print outSHP
                                  gp.Select_analysis (inputFile, outSHP, ""my_attribute" = '" + each_attribute + "'") #<-- CHANGE my_attribute to the name of your attribute

                                  del rows, row, attribute_types, gp

                                  #END





                                  share|improve this answer



























                                    16












                                    16








                                    16







                                    I do not have access to ArcMap 10, only 9.3, but I expect that it won't be very different from this.



                                    You can create a simple script in Python, that checks your attribute field for different values, and then, for each of them runs a SELECT operation to your original Shapefile.



                                    If you are not familiar with python scripting, all you need to do is open you IDLE (the python GUI) create a new file, and copy the code below. After adapting the code for your my_shapefile, outputdir and my_attribute it should work.



                                    # Script created to separate one shapefile in multiple ones by one specific
                                    # attribute

                                    # Example for a Inputfile called "my_shapefile" and a field called "my_attribute"
                                    import arcgisscripting

                                    # Starts Geoprocessing
                                    gp = arcgisscripting.create(9.3)
                                    gp.OverWriteOutput = 1

                                    #Set Input Output variables
                                    inputFile = u"C:\GISTemp\My_Shapefile.shp" #<-- CHANGE
                                    outDir = u"C:\GISTemp\" #<-- CHANGE

                                    # Reads My_shapefile for different values in the attribute
                                    rows = gp.searchcursor(inputFile)
                                    row = rows.next()
                                    attribute_types = set([])

                                    while row:
                                    attribute_types.add(row.my_attribute) #<-- CHANGE my_attribute to the name of your attribute
                                    row = rows.next()

                                    # Output a Shapefile for each different attribute
                                    for each_attribute in attribute_types:
                                    outSHP = outDir + each_attribute + u".shp"
                                    print outSHP
                                    gp.Select_analysis (inputFile, outSHP, ""my_attribute" = '" + each_attribute + "'") #<-- CHANGE my_attribute to the name of your attribute

                                    del rows, row, attribute_types, gp

                                    #END





                                    share|improve this answer















                                    I do not have access to ArcMap 10, only 9.3, but I expect that it won't be very different from this.



                                    You can create a simple script in Python, that checks your attribute field for different values, and then, for each of them runs a SELECT operation to your original Shapefile.



                                    If you are not familiar with python scripting, all you need to do is open you IDLE (the python GUI) create a new file, and copy the code below. After adapting the code for your my_shapefile, outputdir and my_attribute it should work.



                                    # Script created to separate one shapefile in multiple ones by one specific
                                    # attribute

                                    # Example for a Inputfile called "my_shapefile" and a field called "my_attribute"
                                    import arcgisscripting

                                    # Starts Geoprocessing
                                    gp = arcgisscripting.create(9.3)
                                    gp.OverWriteOutput = 1

                                    #Set Input Output variables
                                    inputFile = u"C:\GISTemp\My_Shapefile.shp" #<-- CHANGE
                                    outDir = u"C:\GISTemp\" #<-- CHANGE

                                    # Reads My_shapefile for different values in the attribute
                                    rows = gp.searchcursor(inputFile)
                                    row = rows.next()
                                    attribute_types = set([])

                                    while row:
                                    attribute_types.add(row.my_attribute) #<-- CHANGE my_attribute to the name of your attribute
                                    row = rows.next()

                                    # Output a Shapefile for each different attribute
                                    for each_attribute in attribute_types:
                                    outSHP = outDir + each_attribute + u".shp"
                                    print outSHP
                                    gp.Select_analysis (inputFile, outSHP, ""my_attribute" = '" + each_attribute + "'") #<-- CHANGE my_attribute to the name of your attribute

                                    del rows, row, attribute_types, gp

                                    #END






                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Jun 25 '15 at 6:09

























                                    answered Dec 20 '12 at 11:42









                                    Alexandre NetoAlexandre Neto

                                    10.3k23863




                                    10.3k23863





















                                        13














                                        Did you see Split Layer By Attributes tool updated for ArcMap 10 here? If it does not work you can use Split (Analysis) for your needs.




                                        Splitting the Input Features creates a subset of multiple output
                                        feature classes. The Split Field's unique values form the names of the
                                        output feature classes. These are saved in the target workspace.




                                        split



                                        Example Code:



                                        import arcpy
                                        arcpy.env.workspace = "c:/data"
                                        arcpy.Split_analysis("Habitat_Analysis.gdb/vegtype", "climate.shp", "Zone",
                                        "C:/output/Output.gdb", "1 Meters")





                                        share|improve this answer

























                                        • The built-in Split tool works great for your purposes if you create an extent rectangle the same size as your polygons you wish to split.

                                          – ccn
                                          Jan 31 '13 at 16:25











                                        • Unless I'm misreading the question I think it is asking for a "Split By Attribute" rather than a "Split By Location". Split (Analysis) provides "Split By Location" functionality. The comment by @ccn here offers an interesting workaround which could perhaps be edited in as a "clarification" to this answer.

                                          – PolyGeo
                                          Dec 3 '14 at 6:39











                                        • I worry that the question describes Split By Attribute functionality and your answer is mostly about Split [By Geometry].

                                          – PolyGeo
                                          Jul 27 '17 at 22:56















                                        13














                                        Did you see Split Layer By Attributes tool updated for ArcMap 10 here? If it does not work you can use Split (Analysis) for your needs.




                                        Splitting the Input Features creates a subset of multiple output
                                        feature classes. The Split Field's unique values form the names of the
                                        output feature classes. These are saved in the target workspace.




                                        split



                                        Example Code:



                                        import arcpy
                                        arcpy.env.workspace = "c:/data"
                                        arcpy.Split_analysis("Habitat_Analysis.gdb/vegtype", "climate.shp", "Zone",
                                        "C:/output/Output.gdb", "1 Meters")





                                        share|improve this answer

























                                        • The built-in Split tool works great for your purposes if you create an extent rectangle the same size as your polygons you wish to split.

                                          – ccn
                                          Jan 31 '13 at 16:25











                                        • Unless I'm misreading the question I think it is asking for a "Split By Attribute" rather than a "Split By Location". Split (Analysis) provides "Split By Location" functionality. The comment by @ccn here offers an interesting workaround which could perhaps be edited in as a "clarification" to this answer.

                                          – PolyGeo
                                          Dec 3 '14 at 6:39











                                        • I worry that the question describes Split By Attribute functionality and your answer is mostly about Split [By Geometry].

                                          – PolyGeo
                                          Jul 27 '17 at 22:56













                                        13












                                        13








                                        13







                                        Did you see Split Layer By Attributes tool updated for ArcMap 10 here? If it does not work you can use Split (Analysis) for your needs.




                                        Splitting the Input Features creates a subset of multiple output
                                        feature classes. The Split Field's unique values form the names of the
                                        output feature classes. These are saved in the target workspace.




                                        split



                                        Example Code:



                                        import arcpy
                                        arcpy.env.workspace = "c:/data"
                                        arcpy.Split_analysis("Habitat_Analysis.gdb/vegtype", "climate.shp", "Zone",
                                        "C:/output/Output.gdb", "1 Meters")





                                        share|improve this answer















                                        Did you see Split Layer By Attributes tool updated for ArcMap 10 here? If it does not work you can use Split (Analysis) for your needs.




                                        Splitting the Input Features creates a subset of multiple output
                                        feature classes. The Split Field's unique values form the names of the
                                        output feature classes. These are saved in the target workspace.




                                        split



                                        Example Code:



                                        import arcpy
                                        arcpy.env.workspace = "c:/data"
                                        arcpy.Split_analysis("Habitat_Analysis.gdb/vegtype", "climate.shp", "Zone",
                                        "C:/output/Output.gdb", "1 Meters")






                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Jul 27 '17 at 22:55









                                        PolyGeo

                                        53.9k1781245




                                        53.9k1781245










                                        answered Dec 20 '12 at 8:11









                                        AragonAragon

                                        20.4k34999




                                        20.4k34999












                                        • The built-in Split tool works great for your purposes if you create an extent rectangle the same size as your polygons you wish to split.

                                          – ccn
                                          Jan 31 '13 at 16:25











                                        • Unless I'm misreading the question I think it is asking for a "Split By Attribute" rather than a "Split By Location". Split (Analysis) provides "Split By Location" functionality. The comment by @ccn here offers an interesting workaround which could perhaps be edited in as a "clarification" to this answer.

                                          – PolyGeo
                                          Dec 3 '14 at 6:39











                                        • I worry that the question describes Split By Attribute functionality and your answer is mostly about Split [By Geometry].

                                          – PolyGeo
                                          Jul 27 '17 at 22:56

















                                        • The built-in Split tool works great for your purposes if you create an extent rectangle the same size as your polygons you wish to split.

                                          – ccn
                                          Jan 31 '13 at 16:25











                                        • Unless I'm misreading the question I think it is asking for a "Split By Attribute" rather than a "Split By Location". Split (Analysis) provides "Split By Location" functionality. The comment by @ccn here offers an interesting workaround which could perhaps be edited in as a "clarification" to this answer.

                                          – PolyGeo
                                          Dec 3 '14 at 6:39











                                        • I worry that the question describes Split By Attribute functionality and your answer is mostly about Split [By Geometry].

                                          – PolyGeo
                                          Jul 27 '17 at 22:56
















                                        The built-in Split tool works great for your purposes if you create an extent rectangle the same size as your polygons you wish to split.

                                        – ccn
                                        Jan 31 '13 at 16:25





                                        The built-in Split tool works great for your purposes if you create an extent rectangle the same size as your polygons you wish to split.

                                        – ccn
                                        Jan 31 '13 at 16:25













                                        Unless I'm misreading the question I think it is asking for a "Split By Attribute" rather than a "Split By Location". Split (Analysis) provides "Split By Location" functionality. The comment by @ccn here offers an interesting workaround which could perhaps be edited in as a "clarification" to this answer.

                                        – PolyGeo
                                        Dec 3 '14 at 6:39





                                        Unless I'm misreading the question I think it is asking for a "Split By Attribute" rather than a "Split By Location". Split (Analysis) provides "Split By Location" functionality. The comment by @ccn here offers an interesting workaround which could perhaps be edited in as a "clarification" to this answer.

                                        – PolyGeo
                                        Dec 3 '14 at 6:39













                                        I worry that the question describes Split By Attribute functionality and your answer is mostly about Split [By Geometry].

                                        – PolyGeo
                                        Jul 27 '17 at 22:56





                                        I worry that the question describes Split By Attribute functionality and your answer is mostly about Split [By Geometry].

                                        – PolyGeo
                                        Jul 27 '17 at 22:56











                                        9














                                        I used Alexandre Neto's script and updated it for ArcGIS 10.x users. Mainly you now have to import "arcpy" instead of "arcgisscripting":



                                        # Script created to separate one shapefile in multiple ones by one specific
                                        # attribute

                                        # Example for a Inputfile called "my_shapefile" and a field called "my_attribute"
                                        import arcpy

                                        #Set Input Output variables
                                        inputFile = u"D:DXF-Exportmy_shapefile.shp" #<-- CHANGE
                                        outDir = u"D:DXF-Export\" #<-- CHANGE

                                        # Reads My_shapefile for different values in the attribute
                                        rows = arcpy.SearchCursor(inputFile)
                                        row = rows.next()
                                        attribute_types = set([])

                                        while row:
                                        attribute_types.add(row.my_attribute) #<-- CHANGE my_attribute to the name of your attribute
                                        row = rows.next()

                                        # Output a Shapefile for each different attribute
                                        for each_attribute in attribute_types:
                                        outSHP = outDir + each_attribute + u".shp"
                                        print outSHP
                                        arcpy.Select_analysis (inputFile, outSHP, ""my_attribute" = '" + each_attribute + "'") #<-- CHANGE my_attribute to the name of your attribute

                                        del rows, row, attribute_types

                                        #END





                                        share|improve this answer





























                                          9














                                          I used Alexandre Neto's script and updated it for ArcGIS 10.x users. Mainly you now have to import "arcpy" instead of "arcgisscripting":



                                          # Script created to separate one shapefile in multiple ones by one specific
                                          # attribute

                                          # Example for a Inputfile called "my_shapefile" and a field called "my_attribute"
                                          import arcpy

                                          #Set Input Output variables
                                          inputFile = u"D:DXF-Exportmy_shapefile.shp" #<-- CHANGE
                                          outDir = u"D:DXF-Export\" #<-- CHANGE

                                          # Reads My_shapefile for different values in the attribute
                                          rows = arcpy.SearchCursor(inputFile)
                                          row = rows.next()
                                          attribute_types = set([])

                                          while row:
                                          attribute_types.add(row.my_attribute) #<-- CHANGE my_attribute to the name of your attribute
                                          row = rows.next()

                                          # Output a Shapefile for each different attribute
                                          for each_attribute in attribute_types:
                                          outSHP = outDir + each_attribute + u".shp"
                                          print outSHP
                                          arcpy.Select_analysis (inputFile, outSHP, ""my_attribute" = '" + each_attribute + "'") #<-- CHANGE my_attribute to the name of your attribute

                                          del rows, row, attribute_types

                                          #END





                                          share|improve this answer



























                                            9












                                            9








                                            9







                                            I used Alexandre Neto's script and updated it for ArcGIS 10.x users. Mainly you now have to import "arcpy" instead of "arcgisscripting":



                                            # Script created to separate one shapefile in multiple ones by one specific
                                            # attribute

                                            # Example for a Inputfile called "my_shapefile" and a field called "my_attribute"
                                            import arcpy

                                            #Set Input Output variables
                                            inputFile = u"D:DXF-Exportmy_shapefile.shp" #<-- CHANGE
                                            outDir = u"D:DXF-Export\" #<-- CHANGE

                                            # Reads My_shapefile for different values in the attribute
                                            rows = arcpy.SearchCursor(inputFile)
                                            row = rows.next()
                                            attribute_types = set([])

                                            while row:
                                            attribute_types.add(row.my_attribute) #<-- CHANGE my_attribute to the name of your attribute
                                            row = rows.next()

                                            # Output a Shapefile for each different attribute
                                            for each_attribute in attribute_types:
                                            outSHP = outDir + each_attribute + u".shp"
                                            print outSHP
                                            arcpy.Select_analysis (inputFile, outSHP, ""my_attribute" = '" + each_attribute + "'") #<-- CHANGE my_attribute to the name of your attribute

                                            del rows, row, attribute_types

                                            #END





                                            share|improve this answer















                                            I used Alexandre Neto's script and updated it for ArcGIS 10.x users. Mainly you now have to import "arcpy" instead of "arcgisscripting":



                                            # Script created to separate one shapefile in multiple ones by one specific
                                            # attribute

                                            # Example for a Inputfile called "my_shapefile" and a field called "my_attribute"
                                            import arcpy

                                            #Set Input Output variables
                                            inputFile = u"D:DXF-Exportmy_shapefile.shp" #<-- CHANGE
                                            outDir = u"D:DXF-Export\" #<-- CHANGE

                                            # Reads My_shapefile for different values in the attribute
                                            rows = arcpy.SearchCursor(inputFile)
                                            row = rows.next()
                                            attribute_types = set([])

                                            while row:
                                            attribute_types.add(row.my_attribute) #<-- CHANGE my_attribute to the name of your attribute
                                            row = rows.next()

                                            # Output a Shapefile for each different attribute
                                            for each_attribute in attribute_types:
                                            outSHP = outDir + each_attribute + u".shp"
                                            print outSHP
                                            arcpy.Select_analysis (inputFile, outSHP, ""my_attribute" = '" + each_attribute + "'") #<-- CHANGE my_attribute to the name of your attribute

                                            del rows, row, attribute_types

                                            #END






                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited Sep 30 '15 at 8:55









                                            Hornbydd

                                            27.1k32957




                                            27.1k32957










                                            answered Jun 25 '15 at 5:55









                                            zehpunktbarronzehpunktbarron

                                            1,5591024




                                            1,5591024





















                                                6














                                                This is an even easier way to do this... and it outputs into a GDB.



                                                http://www.umesc.usgs.gov/management/dss/split_by_attribute_tool.html



                                                download the tool from USGS, took me 3 minutes to do what i had been trying for 1 hour.






                                                share|improve this answer























                                                • Thank you for the link! Works like a charm (and for version 10.2!)

                                                  – WolverineTime
                                                  Mar 26 '15 at 17:07











                                                • I tried this tool recently, and nothing happened when I executed it. I chose my feature, selected the field to select features by, selected an output location, hit OK and nothing happened. It just wouldn't "go"...am I missing something? Thanks!

                                                  – rachel.passer
                                                  May 28 '15 at 15:09















                                                6














                                                This is an even easier way to do this... and it outputs into a GDB.



                                                http://www.umesc.usgs.gov/management/dss/split_by_attribute_tool.html



                                                download the tool from USGS, took me 3 minutes to do what i had been trying for 1 hour.






                                                share|improve this answer























                                                • Thank you for the link! Works like a charm (and for version 10.2!)

                                                  – WolverineTime
                                                  Mar 26 '15 at 17:07











                                                • I tried this tool recently, and nothing happened when I executed it. I chose my feature, selected the field to select features by, selected an output location, hit OK and nothing happened. It just wouldn't "go"...am I missing something? Thanks!

                                                  – rachel.passer
                                                  May 28 '15 at 15:09













                                                6












                                                6








                                                6







                                                This is an even easier way to do this... and it outputs into a GDB.



                                                http://www.umesc.usgs.gov/management/dss/split_by_attribute_tool.html



                                                download the tool from USGS, took me 3 minutes to do what i had been trying for 1 hour.






                                                share|improve this answer













                                                This is an even easier way to do this... and it outputs into a GDB.



                                                http://www.umesc.usgs.gov/management/dss/split_by_attribute_tool.html



                                                download the tool from USGS, took me 3 minutes to do what i had been trying for 1 hour.







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Sep 18 '14 at 17:52









                                                David AinleyDavid Ainley

                                                7913




                                                7913












                                                • Thank you for the link! Works like a charm (and for version 10.2!)

                                                  – WolverineTime
                                                  Mar 26 '15 at 17:07











                                                • I tried this tool recently, and nothing happened when I executed it. I chose my feature, selected the field to select features by, selected an output location, hit OK and nothing happened. It just wouldn't "go"...am I missing something? Thanks!

                                                  – rachel.passer
                                                  May 28 '15 at 15:09

















                                                • Thank you for the link! Works like a charm (and for version 10.2!)

                                                  – WolverineTime
                                                  Mar 26 '15 at 17:07











                                                • I tried this tool recently, and nothing happened when I executed it. I chose my feature, selected the field to select features by, selected an output location, hit OK and nothing happened. It just wouldn't "go"...am I missing something? Thanks!

                                                  – rachel.passer
                                                  May 28 '15 at 15:09
















                                                Thank you for the link! Works like a charm (and for version 10.2!)

                                                – WolverineTime
                                                Mar 26 '15 at 17:07





                                                Thank you for the link! Works like a charm (and for version 10.2!)

                                                – WolverineTime
                                                Mar 26 '15 at 17:07













                                                I tried this tool recently, and nothing happened when I executed it. I chose my feature, selected the field to select features by, selected an output location, hit OK and nothing happened. It just wouldn't "go"...am I missing something? Thanks!

                                                – rachel.passer
                                                May 28 '15 at 15:09





                                                I tried this tool recently, and nothing happened when I executed it. I chose my feature, selected the field to select features by, selected an output location, hit OK and nothing happened. It just wouldn't "go"...am I missing something? Thanks!

                                                – rachel.passer
                                                May 28 '15 at 15:09











                                                6














                                                I know you can use an iterator in model builder, but if you prefer to use python here is something I came up with. Add the script to a toolbox with the parameters in order as Input shpfile, fields(multivalue,obtained from input), and workspace. This script will split the shapefile into multiple shapefiles based on the fields you select, and output them into a folder of your choice.



                                                import arcpy, re

                                                arcpy.env.overwriteOutput = True

                                                Input = arcpy.GetParameterAsText(0)
                                                Flds = "%s" % (arcpy.GetParameterAsText(1))
                                                OutWorkspace = arcpy.GetParameterAsText(2)


                                                myre = re.compile(";")
                                                FldsSplit = myre.split(Flds)

                                                sort = "%s A" % (FldsSplit[0])
                                                rows = arcpy.SearchCursor(Input, "", "", Flds, sort)

                                                for row in rows:
                                                var = []
                                                for r in range(len(FldsSplit)):
                                                var.append(row.getValue(FldsSplit[r]))
                                                Query = ''
                                                Name = ''
                                                for x in range(len(var)):
                                                if x == 0:
                                                fildz = FldsSplit[x]
                                                Name = var[x] + "_"
                                                Query += (""" "%s" = '%s'""" % (fildz, var[x]))
                                                if x > 0:
                                                fildz = FldsSplit[x]
                                                Name += var[x] + "_"
                                                Query += (""" AND "%s" = '%s' """ % (fildz, var[x]))
                                                OutputShp = OutWorkspace + r"%s.shp" % (Name)
                                                arcpy.Select_analysis(Input, OutputShp, Query)





                                                share|improve this answer





























                                                  6














                                                  I know you can use an iterator in model builder, but if you prefer to use python here is something I came up with. Add the script to a toolbox with the parameters in order as Input shpfile, fields(multivalue,obtained from input), and workspace. This script will split the shapefile into multiple shapefiles based on the fields you select, and output them into a folder of your choice.



                                                  import arcpy, re

                                                  arcpy.env.overwriteOutput = True

                                                  Input = arcpy.GetParameterAsText(0)
                                                  Flds = "%s" % (arcpy.GetParameterAsText(1))
                                                  OutWorkspace = arcpy.GetParameterAsText(2)


                                                  myre = re.compile(";")
                                                  FldsSplit = myre.split(Flds)

                                                  sort = "%s A" % (FldsSplit[0])
                                                  rows = arcpy.SearchCursor(Input, "", "", Flds, sort)

                                                  for row in rows:
                                                  var = []
                                                  for r in range(len(FldsSplit)):
                                                  var.append(row.getValue(FldsSplit[r]))
                                                  Query = ''
                                                  Name = ''
                                                  for x in range(len(var)):
                                                  if x == 0:
                                                  fildz = FldsSplit[x]
                                                  Name = var[x] + "_"
                                                  Query += (""" "%s" = '%s'""" % (fildz, var[x]))
                                                  if x > 0:
                                                  fildz = FldsSplit[x]
                                                  Name += var[x] + "_"
                                                  Query += (""" AND "%s" = '%s' """ % (fildz, var[x]))
                                                  OutputShp = OutWorkspace + r"%s.shp" % (Name)
                                                  arcpy.Select_analysis(Input, OutputShp, Query)





                                                  share|improve this answer



























                                                    6












                                                    6








                                                    6







                                                    I know you can use an iterator in model builder, but if you prefer to use python here is something I came up with. Add the script to a toolbox with the parameters in order as Input shpfile, fields(multivalue,obtained from input), and workspace. This script will split the shapefile into multiple shapefiles based on the fields you select, and output them into a folder of your choice.



                                                    import arcpy, re

                                                    arcpy.env.overwriteOutput = True

                                                    Input = arcpy.GetParameterAsText(0)
                                                    Flds = "%s" % (arcpy.GetParameterAsText(1))
                                                    OutWorkspace = arcpy.GetParameterAsText(2)


                                                    myre = re.compile(";")
                                                    FldsSplit = myre.split(Flds)

                                                    sort = "%s A" % (FldsSplit[0])
                                                    rows = arcpy.SearchCursor(Input, "", "", Flds, sort)

                                                    for row in rows:
                                                    var = []
                                                    for r in range(len(FldsSplit)):
                                                    var.append(row.getValue(FldsSplit[r]))
                                                    Query = ''
                                                    Name = ''
                                                    for x in range(len(var)):
                                                    if x == 0:
                                                    fildz = FldsSplit[x]
                                                    Name = var[x] + "_"
                                                    Query += (""" "%s" = '%s'""" % (fildz, var[x]))
                                                    if x > 0:
                                                    fildz = FldsSplit[x]
                                                    Name += var[x] + "_"
                                                    Query += (""" AND "%s" = '%s' """ % (fildz, var[x]))
                                                    OutputShp = OutWorkspace + r"%s.shp" % (Name)
                                                    arcpy.Select_analysis(Input, OutputShp, Query)





                                                    share|improve this answer















                                                    I know you can use an iterator in model builder, but if you prefer to use python here is something I came up with. Add the script to a toolbox with the parameters in order as Input shpfile, fields(multivalue,obtained from input), and workspace. This script will split the shapefile into multiple shapefiles based on the fields you select, and output them into a folder of your choice.



                                                    import arcpy, re

                                                    arcpy.env.overwriteOutput = True

                                                    Input = arcpy.GetParameterAsText(0)
                                                    Flds = "%s" % (arcpy.GetParameterAsText(1))
                                                    OutWorkspace = arcpy.GetParameterAsText(2)


                                                    myre = re.compile(";")
                                                    FldsSplit = myre.split(Flds)

                                                    sort = "%s A" % (FldsSplit[0])
                                                    rows = arcpy.SearchCursor(Input, "", "", Flds, sort)

                                                    for row in rows:
                                                    var = []
                                                    for r in range(len(FldsSplit)):
                                                    var.append(row.getValue(FldsSplit[r]))
                                                    Query = ''
                                                    Name = ''
                                                    for x in range(len(var)):
                                                    if x == 0:
                                                    fildz = FldsSplit[x]
                                                    Name = var[x] + "_"
                                                    Query += (""" "%s" = '%s'""" % (fildz, var[x]))
                                                    if x > 0:
                                                    fildz = FldsSplit[x]
                                                    Name += var[x] + "_"
                                                    Query += (""" AND "%s" = '%s' """ % (fildz, var[x]))
                                                    OutputShp = OutWorkspace + r"%s.shp" % (Name)
                                                    arcpy.Select_analysis(Input, OutputShp, Query)






                                                    share|improve this answer














                                                    share|improve this answer



                                                    share|improve this answer








                                                    edited Jul 6 '15 at 21:10









                                                    PolyGeo

                                                    53.9k1781245




                                                    53.9k1781245










                                                    answered Sep 23 '14 at 21:01









                                                    IsaacIsaac

                                                    6114




                                                    6114





















                                                        6














                                                        Split Dataset from GME is a free third-party tool that splits by attribute.






                                                        share|improve this answer















                                                        We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.


















                                                          6














                                                          Split Dataset from GME is a free third-party tool that splits by attribute.






                                                          share|improve this answer















                                                          We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.
















                                                            6












                                                            6








                                                            6







                                                            Split Dataset from GME is a free third-party tool that splits by attribute.






                                                            share|improve this answer















                                                            Split Dataset from GME is a free third-party tool that splits by attribute.







                                                            share|improve this answer














                                                            share|improve this answer



                                                            share|improve this answer








                                                            edited Nov 10 '17 at 6:01









                                                            PolyGeo

                                                            53.9k1781245




                                                            53.9k1781245










                                                            answered Jan 31 '13 at 16:30









                                                            ccnccn

                                                            2,7251519




                                                            2,7251519



                                                            We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.




                                                            We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.






















                                                                4














                                                                I have eventually got it working with SearchCursor and Select_analysis



                                                                arcpy.env.workspace = strInPath
                                                                # create a set to hold the attributes
                                                                attributes=set([])
                                                                # ---- create a list of feature classes in the current workspace ----
                                                                listOfFeatures = arcpy.SearchCursor(strInPath,"","",strFieldName,"")
                                                                for row in listOfFeatures:
                                                                attributes.add(row.getValue(strFieldName))
                                                                count=1
                                                                try:
                                                                for row in attributes:
                                                                stroOutputClass = strBaseName + "_" +str(count)# (str(row.getValue(strFieldName))).replace('/','_')
                                                                strOutputFeatureClass = os.path.join(strOutGDBPath, stroOutputClass)
                                                                arcpy.Select_analysis(strInPath,strOutputFeatureClass,strQueryExp)#"["+strFieldName+"]"+"='"+row+"'")
                                                                count=count+1
                                                                del attributes
                                                                except:
                                                                arcpy.AddMessage('Error found')





                                                                share|improve this answer



























                                                                  4














                                                                  I have eventually got it working with SearchCursor and Select_analysis



                                                                  arcpy.env.workspace = strInPath
                                                                  # create a set to hold the attributes
                                                                  attributes=set([])
                                                                  # ---- create a list of feature classes in the current workspace ----
                                                                  listOfFeatures = arcpy.SearchCursor(strInPath,"","",strFieldName,"")
                                                                  for row in listOfFeatures:
                                                                  attributes.add(row.getValue(strFieldName))
                                                                  count=1
                                                                  try:
                                                                  for row in attributes:
                                                                  stroOutputClass = strBaseName + "_" +str(count)# (str(row.getValue(strFieldName))).replace('/','_')
                                                                  strOutputFeatureClass = os.path.join(strOutGDBPath, stroOutputClass)
                                                                  arcpy.Select_analysis(strInPath,strOutputFeatureClass,strQueryExp)#"["+strFieldName+"]"+"='"+row+"'")
                                                                  count=count+1
                                                                  del attributes
                                                                  except:
                                                                  arcpy.AddMessage('Error found')





                                                                  share|improve this answer

























                                                                    4












                                                                    4








                                                                    4







                                                                    I have eventually got it working with SearchCursor and Select_analysis



                                                                    arcpy.env.workspace = strInPath
                                                                    # create a set to hold the attributes
                                                                    attributes=set([])
                                                                    # ---- create a list of feature classes in the current workspace ----
                                                                    listOfFeatures = arcpy.SearchCursor(strInPath,"","",strFieldName,"")
                                                                    for row in listOfFeatures:
                                                                    attributes.add(row.getValue(strFieldName))
                                                                    count=1
                                                                    try:
                                                                    for row in attributes:
                                                                    stroOutputClass = strBaseName + "_" +str(count)# (str(row.getValue(strFieldName))).replace('/','_')
                                                                    strOutputFeatureClass = os.path.join(strOutGDBPath, stroOutputClass)
                                                                    arcpy.Select_analysis(strInPath,strOutputFeatureClass,strQueryExp)#"["+strFieldName+"]"+"='"+row+"'")
                                                                    count=count+1
                                                                    del attributes
                                                                    except:
                                                                    arcpy.AddMessage('Error found')





                                                                    share|improve this answer













                                                                    I have eventually got it working with SearchCursor and Select_analysis



                                                                    arcpy.env.workspace = strInPath
                                                                    # create a set to hold the attributes
                                                                    attributes=set([])
                                                                    # ---- create a list of feature classes in the current workspace ----
                                                                    listOfFeatures = arcpy.SearchCursor(strInPath,"","",strFieldName,"")
                                                                    for row in listOfFeatures:
                                                                    attributes.add(row.getValue(strFieldName))
                                                                    count=1
                                                                    try:
                                                                    for row in attributes:
                                                                    stroOutputClass = strBaseName + "_" +str(count)# (str(row.getValue(strFieldName))).replace('/','_')
                                                                    strOutputFeatureClass = os.path.join(strOutGDBPath, stroOutputClass)
                                                                    arcpy.Select_analysis(strInPath,strOutputFeatureClass,strQueryExp)#"["+strFieldName+"]"+"='"+row+"'")
                                                                    count=count+1
                                                                    del attributes
                                                                    except:
                                                                    arcpy.AddMessage('Error found')






                                                                    share|improve this answer












                                                                    share|improve this answer



                                                                    share|improve this answer










                                                                    answered May 19 '15 at 23:09









                                                                    Samuel_NETSamuel_NET

                                                                    665




                                                                    665





















                                                                        3














                                                                        I'm not familiar with the Iterate Feature Selection tools in ModelBuilder, but exporting just that as Python code indicate that they can be called using arcpy.



                                                                         # Created on: 2015-05-19 15:26:10.00000
                                                                        # (generated by ArcGIS/ModelBuilder)
                                                                        # Description:
                                                                        # ---------------------------------------------------------------------------

                                                                        # Import arcpy module
                                                                        import arcpy

                                                                        # Load required toolboxes
                                                                        arcpy.ImportToolbox("Model Functions")


                                                                        # Local variables:
                                                                        Selected_Features = ""
                                                                        Value = "1"

                                                                        # Process: Iterate Feature Selection
                                                                        arcpy.IterateFeatureSelection_mb("", "", "false")





                                                                        share|improve this answer



























                                                                          3














                                                                          I'm not familiar with the Iterate Feature Selection tools in ModelBuilder, but exporting just that as Python code indicate that they can be called using arcpy.



                                                                           # Created on: 2015-05-19 15:26:10.00000
                                                                          # (generated by ArcGIS/ModelBuilder)
                                                                          # Description:
                                                                          # ---------------------------------------------------------------------------

                                                                          # Import arcpy module
                                                                          import arcpy

                                                                          # Load required toolboxes
                                                                          arcpy.ImportToolbox("Model Functions")


                                                                          # Local variables:
                                                                          Selected_Features = ""
                                                                          Value = "1"

                                                                          # Process: Iterate Feature Selection
                                                                          arcpy.IterateFeatureSelection_mb("", "", "false")





                                                                          share|improve this answer

























                                                                            3












                                                                            3








                                                                            3







                                                                            I'm not familiar with the Iterate Feature Selection tools in ModelBuilder, but exporting just that as Python code indicate that they can be called using arcpy.



                                                                             # Created on: 2015-05-19 15:26:10.00000
                                                                            # (generated by ArcGIS/ModelBuilder)
                                                                            # Description:
                                                                            # ---------------------------------------------------------------------------

                                                                            # Import arcpy module
                                                                            import arcpy

                                                                            # Load required toolboxes
                                                                            arcpy.ImportToolbox("Model Functions")


                                                                            # Local variables:
                                                                            Selected_Features = ""
                                                                            Value = "1"

                                                                            # Process: Iterate Feature Selection
                                                                            arcpy.IterateFeatureSelection_mb("", "", "false")





                                                                            share|improve this answer













                                                                            I'm not familiar with the Iterate Feature Selection tools in ModelBuilder, but exporting just that as Python code indicate that they can be called using arcpy.



                                                                             # Created on: 2015-05-19 15:26:10.00000
                                                                            # (generated by ArcGIS/ModelBuilder)
                                                                            # Description:
                                                                            # ---------------------------------------------------------------------------

                                                                            # Import arcpy module
                                                                            import arcpy

                                                                            # Load required toolboxes
                                                                            arcpy.ImportToolbox("Model Functions")


                                                                            # Local variables:
                                                                            Selected_Features = ""
                                                                            Value = "1"

                                                                            # Process: Iterate Feature Selection
                                                                            arcpy.IterateFeatureSelection_mb("", "", "false")






                                                                            share|improve this answer












                                                                            share|improve this answer



                                                                            share|improve this answer










                                                                            answered May 19 '15 at 19:29









                                                                            troubbbletroubbble

                                                                            17519




                                                                            17519





















                                                                                3














                                                                                You can use a Search Cursor to loop through individual features in a feature class and write just the geometries to unique feature classes. In this example, I use a feature class of the USA and export the states to new shapefiles:



                                                                                import arcpy

                                                                                # This is a path to an ESRI FC of the USA
                                                                                states = r'C:Program Files (x86)ArcGISDesktop10.2TemplateDataTemplateData.gdbUSAstates'
                                                                                out_path = r'C:temp'

                                                                                with arcpy.da.SearchCursor(states, ["STATE_NAME", "SHAPE@"]) as cursor:
                                                                                for row in cursor:
                                                                                out_name = str(row[0]) # Define the output shapefile name (e.g. "Hawaii")
                                                                                arcpy.FeatureClassToFeatureClass_conversion(row[1], out_path, out_name)





                                                                                share|improve this answer

























                                                                                • I think the downside of this answer is that you do not carry through the attributes. I prefer an answer more like gis.stackexchange.com/a/152165/115 which will.

                                                                                  – PolyGeo
                                                                                  Sep 15 '16 at 22:52











                                                                                • Good point @PolyGeo, however, the upside is that this can be wrapped into other workflows that also require cursor operations.

                                                                                  – Aaron
                                                                                  Sep 16 '16 at 1:46











                                                                                • ... but so could using Select_analysis in place of FeatureClassToFeatureClass - it's only one line of code that would change.

                                                                                  – PolyGeo
                                                                                  Sep 16 '16 at 1:51















                                                                                3














                                                                                You can use a Search Cursor to loop through individual features in a feature class and write just the geometries to unique feature classes. In this example, I use a feature class of the USA and export the states to new shapefiles:



                                                                                import arcpy

                                                                                # This is a path to an ESRI FC of the USA
                                                                                states = r'C:Program Files (x86)ArcGISDesktop10.2TemplateDataTemplateData.gdbUSAstates'
                                                                                out_path = r'C:temp'

                                                                                with arcpy.da.SearchCursor(states, ["STATE_NAME", "SHAPE@"]) as cursor:
                                                                                for row in cursor:
                                                                                out_name = str(row[0]) # Define the output shapefile name (e.g. "Hawaii")
                                                                                arcpy.FeatureClassToFeatureClass_conversion(row[1], out_path, out_name)





                                                                                share|improve this answer

























                                                                                • I think the downside of this answer is that you do not carry through the attributes. I prefer an answer more like gis.stackexchange.com/a/152165/115 which will.

                                                                                  – PolyGeo
                                                                                  Sep 15 '16 at 22:52











                                                                                • Good point @PolyGeo, however, the upside is that this can be wrapped into other workflows that also require cursor operations.

                                                                                  – Aaron
                                                                                  Sep 16 '16 at 1:46











                                                                                • ... but so could using Select_analysis in place of FeatureClassToFeatureClass - it's only one line of code that would change.

                                                                                  – PolyGeo
                                                                                  Sep 16 '16 at 1:51













                                                                                3












                                                                                3








                                                                                3







                                                                                You can use a Search Cursor to loop through individual features in a feature class and write just the geometries to unique feature classes. In this example, I use a feature class of the USA and export the states to new shapefiles:



                                                                                import arcpy

                                                                                # This is a path to an ESRI FC of the USA
                                                                                states = r'C:Program Files (x86)ArcGISDesktop10.2TemplateDataTemplateData.gdbUSAstates'
                                                                                out_path = r'C:temp'

                                                                                with arcpy.da.SearchCursor(states, ["STATE_NAME", "SHAPE@"]) as cursor:
                                                                                for row in cursor:
                                                                                out_name = str(row[0]) # Define the output shapefile name (e.g. "Hawaii")
                                                                                arcpy.FeatureClassToFeatureClass_conversion(row[1], out_path, out_name)





                                                                                share|improve this answer















                                                                                You can use a Search Cursor to loop through individual features in a feature class and write just the geometries to unique feature classes. In this example, I use a feature class of the USA and export the states to new shapefiles:



                                                                                import arcpy

                                                                                # This is a path to an ESRI FC of the USA
                                                                                states = r'C:Program Files (x86)ArcGISDesktop10.2TemplateDataTemplateData.gdbUSAstates'
                                                                                out_path = r'C:temp'

                                                                                with arcpy.da.SearchCursor(states, ["STATE_NAME", "SHAPE@"]) as cursor:
                                                                                for row in cursor:
                                                                                out_name = str(row[0]) # Define the output shapefile name (e.g. "Hawaii")
                                                                                arcpy.FeatureClassToFeatureClass_conversion(row[1], out_path, out_name)






                                                                                share|improve this answer














                                                                                share|improve this answer



                                                                                share|improve this answer








                                                                                edited May 25 '16 at 22:45









                                                                                PolyGeo

                                                                                53.9k1781245




                                                                                53.9k1781245










                                                                                answered Apr 1 '14 at 19:48









                                                                                AaronAaron

                                                                                38.3k21110258




                                                                                38.3k21110258












                                                                                • I think the downside of this answer is that you do not carry through the attributes. I prefer an answer more like gis.stackexchange.com/a/152165/115 which will.

                                                                                  – PolyGeo
                                                                                  Sep 15 '16 at 22:52











                                                                                • Good point @PolyGeo, however, the upside is that this can be wrapped into other workflows that also require cursor operations.

                                                                                  – Aaron
                                                                                  Sep 16 '16 at 1:46











                                                                                • ... but so could using Select_analysis in place of FeatureClassToFeatureClass - it's only one line of code that would change.

                                                                                  – PolyGeo
                                                                                  Sep 16 '16 at 1:51

















                                                                                • I think the downside of this answer is that you do not carry through the attributes. I prefer an answer more like gis.stackexchange.com/a/152165/115 which will.

                                                                                  – PolyGeo
                                                                                  Sep 15 '16 at 22:52











                                                                                • Good point @PolyGeo, however, the upside is that this can be wrapped into other workflows that also require cursor operations.

                                                                                  – Aaron
                                                                                  Sep 16 '16 at 1:46











                                                                                • ... but so could using Select_analysis in place of FeatureClassToFeatureClass - it's only one line of code that would change.

                                                                                  – PolyGeo
                                                                                  Sep 16 '16 at 1:51
















                                                                                I think the downside of this answer is that you do not carry through the attributes. I prefer an answer more like gis.stackexchange.com/a/152165/115 which will.

                                                                                – PolyGeo
                                                                                Sep 15 '16 at 22:52





                                                                                I think the downside of this answer is that you do not carry through the attributes. I prefer an answer more like gis.stackexchange.com/a/152165/115 which will.

                                                                                – PolyGeo
                                                                                Sep 15 '16 at 22:52













                                                                                Good point @PolyGeo, however, the upside is that this can be wrapped into other workflows that also require cursor operations.

                                                                                – Aaron
                                                                                Sep 16 '16 at 1:46





                                                                                Good point @PolyGeo, however, the upside is that this can be wrapped into other workflows that also require cursor operations.

                                                                                – Aaron
                                                                                Sep 16 '16 at 1:46













                                                                                ... but so could using Select_analysis in place of FeatureClassToFeatureClass - it's only one line of code that would change.

                                                                                – PolyGeo
                                                                                Sep 16 '16 at 1:51





                                                                                ... but so could using Select_analysis in place of FeatureClassToFeatureClass - it's only one line of code that would change.

                                                                                – PolyGeo
                                                                                Sep 16 '16 at 1:51











                                                                                2














                                                                                You can use a geometry token (SHAPE@) within Copy Features (Data Management) to export each feature.



                                                                                import arcpy, os

                                                                                shp = r'C:tempyourSHP.shp'
                                                                                outws = r'C:temp'

                                                                                with arcpy.da.SearchCursor(shp, ["OBJECTID","SHAPE@"]) as cursor:
                                                                                for row in cursor:
                                                                                outfc = os.path.join(outws, "fc" + str(row[0]))
                                                                                arcpy.CopyFeatures_management(row[1], outfc)





                                                                                share|improve this answer





























                                                                                  2














                                                                                  You can use a geometry token (SHAPE@) within Copy Features (Data Management) to export each feature.



                                                                                  import arcpy, os

                                                                                  shp = r'C:tempyourSHP.shp'
                                                                                  outws = r'C:temp'

                                                                                  with arcpy.da.SearchCursor(shp, ["OBJECTID","SHAPE@"]) as cursor:
                                                                                  for row in cursor:
                                                                                  outfc = os.path.join(outws, "fc" + str(row[0]))
                                                                                  arcpy.CopyFeatures_management(row[1], outfc)





                                                                                  share|improve this answer



























                                                                                    2












                                                                                    2








                                                                                    2







                                                                                    You can use a geometry token (SHAPE@) within Copy Features (Data Management) to export each feature.



                                                                                    import arcpy, os

                                                                                    shp = r'C:tempyourSHP.shp'
                                                                                    outws = r'C:temp'

                                                                                    with arcpy.da.SearchCursor(shp, ["OBJECTID","SHAPE@"]) as cursor:
                                                                                    for row in cursor:
                                                                                    outfc = os.path.join(outws, "fc" + str(row[0]))
                                                                                    arcpy.CopyFeatures_management(row[1], outfc)





                                                                                    share|improve this answer















                                                                                    You can use a geometry token (SHAPE@) within Copy Features (Data Management) to export each feature.



                                                                                    import arcpy, os

                                                                                    shp = r'C:tempyourSHP.shp'
                                                                                    outws = r'C:temp'

                                                                                    with arcpy.da.SearchCursor(shp, ["OBJECTID","SHAPE@"]) as cursor:
                                                                                    for row in cursor:
                                                                                    outfc = os.path.join(outws, "fc" + str(row[0]))
                                                                                    arcpy.CopyFeatures_management(row[1], outfc)






                                                                                    share|improve this answer














                                                                                    share|improve this answer



                                                                                    share|improve this answer








                                                                                    edited May 20 '15 at 11:21

























                                                                                    answered May 19 '15 at 19:25









                                                                                    AaronAaron

                                                                                    38.3k21110258




                                                                                    38.3k21110258





















                                                                                        2














                                                                                        In Arcpy, Cursors honor layer/TableView selections. According to Getting list of selected features in ArcGIS for Desktop using Python code?, you can simply iterate feature selections.



                                                                                        However if you want to make a selection using arcpy, use SelectLayerByAttribute_management tool.






                                                                                        share|improve this answer





























                                                                                          2














                                                                                          In Arcpy, Cursors honor layer/TableView selections. According to Getting list of selected features in ArcGIS for Desktop using Python code?, you can simply iterate feature selections.



                                                                                          However if you want to make a selection using arcpy, use SelectLayerByAttribute_management tool.






                                                                                          share|improve this answer



























                                                                                            2












                                                                                            2








                                                                                            2







                                                                                            In Arcpy, Cursors honor layer/TableView selections. According to Getting list of selected features in ArcGIS for Desktop using Python code?, you can simply iterate feature selections.



                                                                                            However if you want to make a selection using arcpy, use SelectLayerByAttribute_management tool.






                                                                                            share|improve this answer















                                                                                            In Arcpy, Cursors honor layer/TableView selections. According to Getting list of selected features in ArcGIS for Desktop using Python code?, you can simply iterate feature selections.



                                                                                            However if you want to make a selection using arcpy, use SelectLayerByAttribute_management tool.







                                                                                            share|improve this answer














                                                                                            share|improve this answer



                                                                                            share|improve this answer








                                                                                            edited Jul 27 '17 at 22:59









                                                                                            PolyGeo

                                                                                            53.9k1781245




                                                                                            53.9k1781245










                                                                                            answered May 19 '15 at 19:23









                                                                                            Farid CheraghiFarid Cheraghi

                                                                                            8,29411447




                                                                                            8,29411447





















                                                                                                1














                                                                                                The "Split by Attributes" tool in the Analysis, Extract toolbox will create a new Shapefile for each unique value from the Field you select.






                                                                                                share|improve this answer





























                                                                                                  1














                                                                                                  The "Split by Attributes" tool in the Analysis, Extract toolbox will create a new Shapefile for each unique value from the Field you select.






                                                                                                  share|improve this answer



























                                                                                                    1












                                                                                                    1








                                                                                                    1







                                                                                                    The "Split by Attributes" tool in the Analysis, Extract toolbox will create a new Shapefile for each unique value from the Field you select.






                                                                                                    share|improve this answer















                                                                                                    The "Split by Attributes" tool in the Analysis, Extract toolbox will create a new Shapefile for each unique value from the Field you select.







                                                                                                    share|improve this answer














                                                                                                    share|improve this answer



                                                                                                    share|improve this answer








                                                                                                    edited Apr 14 '18 at 20:11









                                                                                                    PolyGeo

                                                                                                    53.9k1781245




                                                                                                    53.9k1781245










                                                                                                    answered Nov 9 '17 at 21:53









                                                                                                    klewisklewis

                                                                                                    6,9351218




                                                                                                    6,9351218





















                                                                                                        0














                                                                                                        You can use a searchcursor to select each row of your file and then use copy features to export it as an individual file.






                                                                                                        share|improve this answer



























                                                                                                          0














                                                                                                          You can use a searchcursor to select each row of your file and then use copy features to export it as an individual file.






                                                                                                          share|improve this answer

























                                                                                                            0












                                                                                                            0








                                                                                                            0







                                                                                                            You can use a searchcursor to select each row of your file and then use copy features to export it as an individual file.






                                                                                                            share|improve this answer













                                                                                                            You can use a searchcursor to select each row of your file and then use copy features to export it as an individual file.







                                                                                                            share|improve this answer












                                                                                                            share|improve this answer



                                                                                                            share|improve this answer










                                                                                                            answered Nov 9 '17 at 21:44









                                                                                                            jchestjchest

                                                                                                            617




                                                                                                            617



























                                                                                                                draft saved

                                                                                                                draft discarded
















































                                                                                                                Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                                                                                                                • Please be sure to answer the question. Provide details and share your research!

                                                                                                                But avoid


                                                                                                                • Asking for help, clarification, or responding to other answers.

                                                                                                                • Making statements based on opinion; back them up with references or personal experience.

                                                                                                                To learn more, see our tips on writing great answers.




                                                                                                                draft saved


                                                                                                                draft discarded














                                                                                                                StackExchange.ready(
                                                                                                                function ()
                                                                                                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f9998%2fexporting-feature-class-into-multiple-feature-classes-based-on-field-values-usin%23new-answer', 'question_page');

                                                                                                                );

                                                                                                                Post as a guest















                                                                                                                Required, but never shown





















































                                                                                                                Required, but never shown














                                                                                                                Required, but never shown












                                                                                                                Required, but never shown







                                                                                                                Required, but never shown

































                                                                                                                Required, but never shown














                                                                                                                Required, but never shown












                                                                                                                Required, but never shown







                                                                                                                Required, but never shown







                                                                                                                Popular posts from this blog

                                                                                                                រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

                                                                                                                Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

                                                                                                                Romeo and Juliet ContentsCharactersSynopsisSourcesDate and textThemes and motifsCriticism and interpretationLegacyScene by sceneSee alsoNotes and referencesSourcesExternal linksNavigation menu"Consumer Price Index (estimate) 1800–"10.2307/28710160037-3222287101610.1093/res/II.5.31910.2307/45967845967810.2307/2869925286992510.1525/jams.1982.35.3.03a00050"Dada Masilo: South African dancer who breaks the rules"10.1093/res/os-XV.57.1610.2307/28680942868094"Sweet Sorrow: Mann-Korman's Romeo and Juliet Closes Sept. 5 at MN's Ordway"the original10.2307/45957745957710.1017/CCOL0521570476.009"Ram Leela box office collections hit massive Rs 100 crore, pulverises prediction"Archived"Broadway Revival of Romeo and Juliet, Starring Orlando Bloom and Condola Rashad, Will Close Dec. 8"Archived10.1075/jhp.7.1.04hon"Wherefore art thou, Romeo? To make us laugh at Navy Pier"the original10.1093/gmo/9781561592630.article.O006772"Ram-leela Review Roundup: Critics Hail Film as Best Adaptation of Romeo and Juliet"Archived10.2307/31946310047-77293194631"Romeo and Juliet get Twitter treatment""Juliet's Nurse by Lois Leveen""Romeo and Juliet: Orlando Bloom's Broadway Debut Released in Theaters for Valentine's Day"Archived"Romeo and Juliet Has No Balcony"10.1093/gmo/9781561592630.article.O00778110.2307/2867423286742310.1076/enst.82.2.115.959510.1080/00138380601042675"A plague o' both your houses: error in GCSE exam paper forces apology""Juliet of the Five O'Clock Shadow, and Other Wonders"10.2307/33912430027-4321339124310.2307/28487440038-7134284874410.2307/29123140149-661129123144728341M"Weekender Guide: Shakespeare on The Drive""balcony"UK public library membership"romeo"UK public library membership10.1017/CCOL9780521844291"Post-Zionist Critique on Israel and the Palestinians Part III: Popular Culture"10.2307/25379071533-86140377-919X2537907"Capulets and Montagues: UK exam board admit mixing names up in Romeo and Juliet paper"Istoria Novellamente Ritrovata di Due Nobili Amanti2027/mdp.390150822329610820-750X"GCSE exam error: Board accidentally rewrites Shakespeare"10.2307/29176390149-66112917639"Exam board apologises after error in English GCSE paper which confused characters in Shakespeare's Romeo and Juliet""From Mariotto and Ganozza to Romeo and Guilietta: Metamorphoses of a Renaissance Tale"10.2307/37323537323510.2307/2867455286745510.2307/28678912867891"10 Questions for Taylor Swift"10.2307/28680922868092"Haymarket Theatre""The Zeffirelli Way: Revealing Talk by Florentine Director""Michael Smuin: 1938-2007 / Prolific dance director had showy career"The Life and Art of Edwin BoothRomeo and JulietRomeo and JulietRomeo and JulietRomeo and JulietEasy Read Romeo and JulietRomeo and Julieteeecb12003684p(data)4099369-3n8211610759dbe00d-a9e2-41a3-b2c1-977dd692899302814385X313670221313670221