How to export shape file based on data driven page limits

810
7
11-04-2017 03:32 PM
BrianChapman1
New Contributor

Need help to export shape files based on limits of dataframes... I've got this far but think I'm going in the wrong direction:

import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]

for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
arcpy.FeatureClassToFeatureClass_conversion("ParcelPoly","C:\Test\name","name"... need help here
del mxd

Tags (2)
0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus

FeatureClassToFeatureClass has no extent parameter.  Are you perhaps trying to clip to the extent

Or Clipping the Data Frame.... specifically Clipping to currrent data driven page extent...  These two don't actually clip featureclasses either

BrianChapman1
New Contributor

Basically just looking to export data based on the limits of the dataframe without doing it manually.  Maybe I can find another way.  Thanks!

0 Kudos
XanderBakker
Esri Esteemed Contributor

You can stil do that by scripting, but is there just one layer in your dataframe or multiple layers? Have you thought about the output names of the featureclasses that you will create? And perhaps more importantly, why do you want to do this? Is it really necessary?

You could read out the extents of the pages and create a featureclass and loop through the features of that featureclass and clip the featureclass(es) and create the outputs.

BrianChapman1
New Contributor

Yea...names aren't important. It's basically one shape file (covering a huge limits) that I'm trying to divide into smaller files to make the size of the shape files more manageable with 3rd party software.  

0 Kudos
XanderBakker
Esri Esteemed Contributor

Your dataframe extents may have overlap depending on how they were defined in relation to the size of your dataframe. If the idea is to manage it in smaller chunks in 3rd party software, you could consider to Create Fishnet—Help | ArcGIS Desktop , and Intersect—Help | ArcGIS Desktop  and then use Split By Attributes—Help | ArcGIS Desktop or http://www.arcgis.com/home/item.html?id=15ca63aebb4647a4b07bc94f3d051da5 depending on the version you have.

DarrenWiens2
MVP Honored Contributor

More info:

Use the DataFrame Extent Polygon to Clip your feature class, inside the loop.

BrianChapman1
New Contributor

Thanks

0 Kudos