5

I have a map showing the outline of an area which I'm using to clip other layers using the data frame > clip options.

Data frame Clip

In addition, I have other data frames to show some detail and want to show the extent indicators on the first map.

Is it possible to exclude the extent indicator from the data frame clip options as it isn't listed as a separate layer in the Exclude Layers... button?

So in the in the image below I want to keep the blue lines clipped to the shape, but have the entire red extent indicator visible.

Extent indicator

  • May be easier to just add a graphic rectangle with the drawing toolbar, unless of course the extent changes. – landocalrissian Feb 18 '15 at 12:59
4

The script below will create a new shapefile with a feature representing the extent of each data frame in a map document. The data frame name is saved in a field called DFName. Once you've run this you can add it to your main data frame as a normal layer and exclude it as you would any other (the "Exclude layers..." button).

You'll still need to leave the existing extent indicators on if you want to use leader lines between the dataframes and their extent indicators.

import arcpy
import os

folder = r'C:\Data' # adjust as required

mxd = arcpy.mapping.MapDocument('CURRENT')
dfs = arcpy.mapping.ListDataFrames(mxd)

fc = arcpy.CreateFeatureclass_management(folder, 'extent.shp', "POLYGON", None, "DISABLED", "DISABLED", None)
arcpy.AddField_management(fc, 'DFName', 'TEXT', None, None, 250, "", "NULLABLE", "NON_REQUIRED")  

cur = arcpy.InsertCursor(os.path.join(folder, 'extent.shp'))

for df in dfs:
    extent = df.extent
    array = arcpy.Array()
    array.add(extent.lowerLeft)
    array.add(extent.lowerRight)
    array.add(extent.upperRight)
    array.add(extent.upperLeft)
    array.add(extent.lowerLeft)
    polygon = arcpy.Polygon(array)

    feat = cur.newRow()
    feat.shape = polygon
    feat.DFName = df.name
    cur.insertRow(feat)

    array.removeAll()

del(cur)
0

It doesn't totally solve the problem, but I did find a button in the Customize options that creates a polygon feature for the current data frame:

Create Data Frame Polygon

This would have to be repeated if there are multiple data frames, but at least it would allow the outline to be selected in the exclude layers options.

  • 2
    What version of ArcGIS is this found in? I'm not seeing it? Do you have any extensions added? – Fezter May 16 '16 at 4:50

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.