+ Reply to Thread
Results 1 to 10 of 10

Thread: Clip Output to Graphics Extent with arcpy

  1. #1
    Jane Wickers
    Join Date
    Jul 2010
    Posts
    21
    Points
    1
    Answers Provided
    0


    0

    Default Clip Output to Graphics Extent with arcpy

    When exporting a map from layout in ArcMap there is an option to "Clip Output to Graphics Extent". Is it possible to automate this function with arcpy?

    Jane

  2. #2
    Jeffrey Barrette

    Join Date
    Oct 2009
    Posts
    711
    Points
    201
    Answers Provided
    64


    0

    Default Re: Clip Output to Graphics Extent with arcpy

    Jane,

    This option is not available in with the arcpy.mapping Export functions. I'd like to know more about how you use this and why. I also recommend that you add this to the http://ideas.arcgis.com website. It may be possible to add in a future release but we'd really like to know the use cases in terms of map automation.

    Thanks,
    Jeff

  3. #3
    Jane Wickers
    Join Date
    Jul 2010
    Posts
    21
    Points
    1
    Answers Provided
    0


    1

    Default Re: Clip Output to Graphics Extent with arcpy

    Thanks Jeff. I am creating a tool where the user inputs a Property Number, Scale and Description. The mxd then zooms to that Property at the scale nominated and outputs to a pdf. The user who has requested this tool frequently uses the Clip Output to Graphics Extent to export to the pdf. She has asked me to incorporate this into my tool (using arcy).

    Jane

  4. #4
    Kathleen Crombez
    Join Date
    Apr 2010
    Posts
    19
    Points
    0
    Answers Provided
    0


    0

    Default Re: Clip Output to Graphics Extent with arcpy

    I also need this functionality. We create a tax map book application on CD that has to be completely functional without access to the internet. The website has images that I export from ArcMap as a png that has corresponding rollover hotspots for the townships and the map book pages. For duplication purposes (we build this application for every revenue year), it is critical that the exported images are clipped to the graphics extent or the rollovers will not line up on the images. This is the only process holdng me up from running a python script to completely automate the process of building the application every year. I have to manually export nearly 40 images before i can run my script and the application gets built. I hope this functionality gets implimented in the next release.

  5. #5
    Jeffrey Barrette

    Join Date
    Oct 2009
    Posts
    711
    Points
    201
    Answers Provided
    64


    0

    Default Re: Clip Output to Graphics Extent with arcpy

    As an alternative, why can't you just use a masking layer? The masking layer can "white out" the zone outside the area of interest before the export is done.

    This can be done in the user interface with Data Driven Pages using page definitions (via the definition query tab).

    Or it can be done with arcpy.mapping in a similar way but by automating the updating of definition queries.

    Jeff

  6. #6
    Karla Mayne
    Join Date
    Feb 2011
    Posts
    5
    Points
    0
    Answers Provided
    0


    0

    Default Re: Clip Output to Graphics Extent with arcpy

    Hi Jeff,

    I'm currently working on a script for exporting ddp with a mask layer and I'm having trouble getting the definition query to update for each page as it exports. I'd appreciate it if you could take a look and provide suggestions. Here's the script:

    Code:
    import arcpy, sys, os
    arcpy.env.overwriteOutput = True
    mxd = arcpy.mapping.MapDocument("CURRENT")
    
    print "Enter save as pdf location:"
    pdfDir = arcpy.GetParameterAsText(0)
    outputFolder = pdfDir + r"\PDFs"
    
    df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
    maskLayer = arcpy.mapping.ListLayers(mxd, "state_bnd110", df)[0]
    maskField = "STATE_NAME"
    
    for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
        mxd.dataDrivenPages.currentPageID = pageNum
        pageName = mxd.dataDrivenPages.pageRow.STATE_NAME
        for lyr in arcpy.mapping.ListLayers(mxd):
            if lyr.name == maskLayer:
                lyr.definitionQuery = '"STATE_NAME" <> %s' % pageName
        arcpy.RefreshActiveView()
        arcpy.mapping.ExportToPDF(mxd, os.path.dirname(outputFolder)+ os.sep + pageName + ".pdf")
    
    del mxd
    arcpy.GetMessages()
    Thanks,
    Karla

  7. #7
    Nils Babel
    Join Date
    May 2010
    Posts
    61
    Points
    1
    Answers Provided
    1


    0

    Default Re: Clip Output to Graphics Extent with arcpy

    I had the same issue. I was using the clip output to graphics extent in the tool and wanted to automate the process. I'm creating map graphics for reports and PPTs. I use the clip graphics function because I don't want the extra white space around my graphic. To get around this in Arcpy I resized my layout. Under page and print layout I unchecked the use printer paper settings option. Then I moved my dataframe and layout items to an origin of 0, 0 on the Size and Position properties tab. This essentially eliminates the "margin" that is needed for printing to paper. This works for me because I'm just exporting the maps to graphics. The downside is if you want to print the mxd you'll likely lose the edge of your map because there is no longer a margin. I guess if you do it this way you don't really need the clip output option in the Arcpy function but it still would be nice to have the option.

  8. #8
    Marc Cusumano
    Join Date
    Oct 2010
    Posts
    109
    Points
    3
    Answers Provided
    3


    0

    Default Re: Clip Output to Graphics Extent with arcpy

    Can "Clip to Graphics Extent" be used in a python script utilizing the ArcPy.ExportCAD_conversion method? We are trying to export DXF tiles based on a grid layer and providing an extent makes a selection of features passing through, but does not clip the output to the proper extent, resulting in features running way outside the boundaries of each tile.

  9. #9
    A Nilsen
    Join Date
    Jun 2011
    Posts
    2
    Points
    0
    Answers Provided
    0


    0

    Default Re: Clip Output to Graphics Extent with arcpy

    Hi,
    will "Clip Output to Graphics Extent" when exporting a map to pdf be included in arcpy in ver. 10.1?
    And/or is it another way to clip to output extent before exporting to pdf through arcpy?
    Best regards
    Anne

  10. #10
    Jeffrey Barrette

    Join Date
    Oct 2009
    Posts
    711
    Points
    201
    Answers Provided
    64


    0

    Default Re: Clip Output to Graphics Extent with arcpy

    This direct capability was not added at 10.1 but have you tried definition queries and page definitions (with DDP)?

    Jeff
    Last edited by jbarrette; 06-19-2012 at 07:08 AM.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts