# ArcGIS desktop map package, with clipping

Package Map (Data Management) almost does what I want: take everything in my current map, wrap it up in a nice little parcel with all geometry, attributes, labels, symbols, etc. etc. configured just the way that's needed into a single file that can be handed off to someone else or archived as a snapshot in project time.

The one thing the out of the box tool does not do which I need is clip. Clip everything to dataframe, clip to selected polygon (or graphic), clip to visible area (plus a margin), and then apply Package Map magic.

How might this be done?

I built a script for the first half of this: clip_all_layers.py, Clips all layers in map to the specified polygon layer. Command line usage:

python clip_all_layers.py "path\to\Some map.mxd" path\to\data.gdb\clip_poly path\to\destination.gdb


Relative paths are interpreted relative to the mxd, not the current shell folder (ref). There's an example toolbox usage in the Tests folder.

It's adapted from Alex Tereshenkov's work at Clipping faster (i.e. in bulk/batch) in ArcGIS for Desktop?

Yes you can in arcpy.PackageMap_management, there is a parameter called extent you can use it to clip map data to the dataframe. e.g. to clip by dataframe use DISPLAY...

Have a look at here

• I tried using /extent/ but it no clipping occurred. I think it may mean "include whatever features intersect with /extent/". I'm happy to be proven wrong. Is your experience different? – matt wilkie Jan 30 '15 at 6:20
• to me arcpy.PackageMap_management("C:\Users\USER_NAME\Desktop\Untitled.mxd","C:\Users\USER_NAME\Desktop\Untitled.mpk","CONVERT","CONVERT_ARCSDE",'DISPLAY',"ALL") works fantastic. – SIslam Jan 30 '15 at 6:23
• Not for me. I get an intersect selection, not clip; screenshots of my before and after (with v10.3). – matt wilkie Jan 30 '15 at 17:17
• It drivied me crazy, why i am getting clipped result though some extra feature -------before dropbox.com/s/t0zwwqgkqha15n9/1.png?dl=0 and after dropbox.com/s/kh8dxrn9gtq7smo/2.png?dl=0 – SIslam Jan 30 '15 at 19:30
• Per the doc, extent with features does SELECT/EXTRACT. For Rasters it does a clip: For feature layers, the Extent parameter is used to select the features that will be consolidated. For raster layers, the Extent parameter is used to clip the raster datasets. – KHibma Feb 26 '15 at 19:52