Is there any way to use Data Driven Pages to generate shapefiles instead of generating PDF? Because I need to export shapefiles generated with their layout in DWG format. If not, do you have an idea of the procedure that I can follow to achieve this task in a more effcient way?

  • Could you try something like this... Join your features to the layout grid (layer that is driving your DDP) then select features from those layers with a common join factor (like grid name, etc), export those selected features as a shapefile and/or convert them to CAD.
    – Branco
    Apr 10, 2015 at 16:53
  • 2
    If I understand correctly what you're trying to do, I'm pretty sure this is impossible. It sounds like you want to export each page so that the entire layout (the map itself, the north arrow, scale bar, any text, logos, graphics, etc.) is converted to shapefiles.
    – Dan C
    Apr 10, 2015 at 16:56
  • I do have a python script that exports individual features based on a value in a selected field if that would help. It creates them as separate shapefiles however but you could add the convert to cad. As Dan has indicated that would not cover the other map elements. Apr 10, 2015 at 17:00
  • that's exactly what Dan understood, but since there is no possibility for it as you said, my main goal now is to export the entity with its neighbors, even if I do not export the entire layout
    – sofyan
    Apr 10, 2015 at 17:17
  • jbchurchill can you post your script, it will probably help
    – sofyan
    Apr 10, 2015 at 17:20

1 Answer 1


This will export individual features from a feature class into separate shapefiles based on a name in a field. You will LIKELY need to work with the field names because it will work very differently depending on whether the field is a STRING or some other numeric type etc. Therefore expect to spend some time fiddling with the exact syntax of the WhereClause. Pay particular attention to wrapping the values with quotes for strings or not wrapping them in quotes (for a number). Try the query in ArcMap to see how it is formulated.

For example I had a hyphen in all values and had to replace that with an underscore like this ...

strValue = strValue.replace("-", "_")

You may find similar issues but hopefully this will help.


inFC = r"C:\SOMEFOLDER\SOMESHAPEFILE.shp" # could also be fc in a gdb etc.
fld_Species = 'ZoneMod' #My field was ZoneMod; replace this with the field in SOMESHAPEFILE 

arcpy.AddMessage("Creating output in " + ws_Output + "\nfrom the " + fld_Species + "\nfield in the " + inFC + " feature class")

envString = arcpy.ListEnvironments()

def ExpIndFeatures(inWorkspace, inShapeFile, inField):
    arcpy.env.workspace = inWorkspace
        ID_List = []
        SrchCursor = arcpy.SearchCursor(inShapeFile)
        rec = SrchCursor.next()

        while rec:
            ID_value = rec.getValue(inField)
            rec = SrchCursor.next()
        ID_List2 = set(ID_List)
        ID_List3 = list(ID_List2)    

        n = 0
        while (n < len(ID_List3)):
            ID_value = ID_List3[n]
            # WhereClause = '"' + str(inField) + '" = ' + str(ID_value)
            strValue = str(ID_value)
            WhereClause = str(inField) + ' = \'' + strValue + '\''
            fileName = "tmp" + strValue + ".shp"
            arcpy.MakeFeatureLayer_management(inShapeFile, fileName)
            arcpy.SelectLayerByAttribute_management(fileName, "NEW_SELECTION", WhereClause)
            arcpy.CopyFeatures_management(fileName, "output_" + strValue + ".shp")
            n = n + 1
            print "processing code: " + str(n)

        print "WHATEVERYOUNAMETHIS.py has completed"

        print arcpy.GetMessages()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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