geodatabase export to shapefiles

3746
14
12-13-2016 12:36 PM
johncoon
New Contributor

I can't seem to find a tool in ArcMap 10.2.2 standard that allows you to export all the layers in my TOC to a directory

with each shapefile file name per layer in the TOC. I have a template geodatabase that I loaded shape file data into, then edited that data. Now I need to export some 100 plus layers from the geodatabase as shape files to update the original data.

Because of that, I'm looking for a Python sample that exports all the layers in my TOC  to a file location or a function that selects the current geodatabase and exports all the features to shape files. Do you just copy and paste Python code to run it?

Is this something that can be none if I've never used Python before. I didn't see a lot of help for it, but I might of been looking in the wrong location. I looked around for a VBA macro editor as well and could located that. I might have a chance with that.

Thank you

John

Tags (1)
0 Kudos
14 Replies
MitchHolley1
MVP Regular Contributor

This may get you started:

import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")

outputDir = r'path to output folder location to store .shp'

for x in arcpy.mapping.ListLayers(mxd):
    desc = arcpy.Describe(x)
    path = desc.catalogPath
    arcpy.FeatureClassToShapefile_conversion (path, outputDir)
    
0 Kudos
johncoon
New Contributor

Mitch.

Thank you. I’ll see if I can get this to work. Still want to know what it’s doing, that might take longer.

John

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

Mitch's script is pretty straight forward and reading it should give you an idea of what it is doing.  This is meant to run in the python window if you are in the map document (.mxd).  This is not a standalone python script.  just fyi.

0 Kudos
johncoon
New Contributor

Rebecca,

This is like the old days modifying LISP routine. Just try it.

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

Or for those of us that are long time ArcINFO workstation users... AML.

0 Kudos