Intersecting Layers Masks (Cartography)

Summary

Creates masking polygons at a specified shape and size at the intersection of two symbolized input layers: the masking layer and the masked layer.

See How Feature Outline Masks and Intersecting Layers Masks work to learn more about the kinds of masks you can create.

Usage

  • This tool accepts point, line, and polygon feature layers as well as geodatabase annotation layers as input.

  • Typically, margins are greater than 0. A margin size of 0 creates masks that represent the exact shape of the symbolized features.

  • When creating masks, it is important to know that adding masks to maps adds complexity that will slow map drawing and affect map printing and exporting. Generally, there are three things to consider when creating masks for a map: the number of masks, the complexity of the masks, and whether the masks will be used to mask polygon features filled with marker or line symbols. An increase in the number of masks, having more complex masks, and masking against marker or polygon fill symbols will result in slower drawing on your screen. Additionally, printing and exporting performance can be poor and even fail to produce valid output. This is because of the large amount of processing required to print and export maps with masks, and because of known limitations in how graphic file formats store map export results that have many complicated masks.

  • To improve drawing performance as well as printing and exporting performance and reliability, the most important guideline to follow is to use the simplest masks necessary for the purposes of your map. In particular, when masking annotation text, CONVEX_HULL type masks are sufficient for many map purposes. If you need more detailed text masks, use the EXACT_SIMPLIFIED type. Generally, when masking much text on a relatively large map, avoid using the EXACT type mask, because it will create too many complicated masks to produce valid output efficiently.

  • Margin values are specified in either page units or map units. Most of the time, you will specify your margin distance value in page units.

    Margin value units are interpreted differently depending on the units you choose. If you choose points, inches, millimeters, or centimeters, masks will be created using the margin distance as calculated in page space (think of the margin as a distance measured on the paper). The reference scale parameter value is taken into account for in this calculation.

    If you choose any other units for your margin, masks will be created using the margin distance as calculated in map space (think of the margin as a real-world distance measure on the earth). Also, in this case, the reference scale parameter value is not used as part of the calculation.

  • If one of the input layers is an annotation layer, the reference scale will be automatically set to the reference scale of the layer's feature class to ensure accurate calculation of the mask. If two annotation layers are being intersected, they must have the same reference scale.

  • When masking annotation projected on the fly, masks should be created using the map's spatial reference by properly setting it in the spatial reference parameter. Readability is preserved when text is projected on the fly, which is why there may be differences in the spatial area text occupies in different projections.

  • Masks of annotation features are font specific. When using masks with text, it is important to ensure that the same font is used onscreen as in the output. To do this, embed fonts in vector output or download SoftFonts to printers or plotters.

  • Processing large datasets together may exceed memory limitations. In this case, consider processing input data by partition by identifying a relevant polygon feature class in the Cartographic Partitions environment setting. Portions of the data, defined by partition boundaries, will be processed sequentially. The output feature class will be seamless and consistent at partition edges.

Parameters

LabelExplanationData Type
Masking Layer

The symbolized input layer that will intersect the masked layer to create masking polygons. This is the layer that will be prominently displayed when masking is applied to the masked layer.

Layer
Masked Layer

The symbolized input layer to be masked. This is the layer that will be obscured by the masking polygons.

Layer
Output Feature Class

The feature class that will contain the mask features.

Feature Class
Reference Scale

The reference scale used for calculating the masking geometry when masks are specified in page units. This is typically the reference scale of the map.

Double
Calculation coordinate system

The spatial reference of the map in which the masking polygons will be created. This is not the spatial reference that will be assigned to the output feature class. It is the spatial reference of the map in which the masking polygons will be used, since the position of symbology may change when features are projected.

Spatial Reference
Margin

The space in page units surrounding the symbolized input features used to create the mask polygons. Typically, masking polygons are created with a small margin around the symbol to improve visual appearance. Margin values are specified in either page units or map units. Most of the time, you will specify your margin distance value in page units.

The margin cannot be negative.

Linear Unit
Mask Kind

Specifies the type of masking geometry created.

  • Box — A polygon representing the extent of the symbolized feature.
  • Convex hull — The convex hull of the symbolized geometry of the feature. This is the default.
  • Exact simplified — A generalized polygon representing the exact shape of the symbolized feature. Polygons created with this method will have a significantly smaller number of vertices compared to polygons created with the EXACT method.
  • Exact — A polygon representing the exact shape of the symbolized feature.
String
Create masks for unplaced annotation

Specifies whether to create masks for unplaced annotation. This option is only used when masking geodatabase annotation layers.

  • All annotation features — Creates masks for all the annotation features.
  • Only placed annotation features — Only creates masks for features with a status of placed.
String
Transfer Attributes
(Optional)

Specifies the attributes that will be transferred from the input features to the output features.

  • Only the FID field — Only the FID field from the input features will be transferred to the output features. This is the default.
  • All attributes except the FID field — All the attributes except the FID from the input features will be transferred to the output features.
  • All attributes — All the attributes from the input features will be transferred to the output features.
String

arcpy.cartography.IntersectingLayersMasks(masking_layer, masked_layer, output_fc, reference_scale, spatial_reference, margin, method, mask_for_non_placed_anno, {attributes})
NameExplanationData Type
masking_layer

The symbolized input layer that will intersect the masked layer to create masking polygons. This is the layer that will be prominently displayed when masking is applied to the masked layer.

Layer
masked_layer

The symbolized input layer to be masked. This is the layer that will be obscured by the masking polygons.

Layer
output_fc

The feature class that will contain the mask features.

Feature Class
reference_scale

The reference scale used for calculating the masking geometry when masks are specified in page units. This is typically the reference scale of the map.

Double
spatial_reference

The spatial reference of the map in which the masking polygons will be created. This is not the spatial reference that will be assigned to the output feature class. It is the spatial reference of the map in which the masking polygons will be used, since the position of symbology may change when features are projected.

Spatial Reference
margin

The space in page units surrounding the symbolized input features used to create the mask polygons. Typically, masking polygons are created with a small margin around the symbol to improve visual appearance. Margin values are specified in either page units or map units. Most of the time, you will specify your margin distance value in page units.

The margin cannot be negative.

Linear Unit
method

Specifies the type of masking geometry created.

  • BOXA polygon representing the extent of the symbolized feature.
  • CONVEX_HULLThe convex hull of the symbolized geometry of the feature. This is the default.
  • EXACT_SIMPLIFIEDA generalized polygon representing the exact shape of the symbolized feature. Polygons created with this method will have a significantly smaller number of vertices compared to polygons created with the EXACT method.
  • EXACTA polygon representing the exact shape of the symbolized feature.
String
mask_for_non_placed_anno

Specifies whether to create masks for unplaced annotation. This option is only used when masking geodatabase annotation layers.

  • ALL_FEATURESCreates masks for all the annotation features.
  • ONLY_PLACEDOnly creates masks for features with a status of placed.
String
attributes
(Optional)

Specifies the attributes that will be transferred from the input features to the output features.

  • ONLY_FIDOnly the FID field from the input features will be transferred to the output features. This is the default.
  • NO_FIDAll the attributes except the FID from the input features will be transferred to the output features.
  • ALLAll the attributes from the input features will be transferred to the output features.
String

Code sample

IntersectingLayersMasks example 1 (Python window)

The following Python window script demonstrates how to use the IntersectingLayersMasks tool in immediate mode.

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.IntersectingLayersMasks_cartography("C:/data/cartography.gdb/transportation/roads",
                                          "C:/data/cartography.gdb/transportation/railroads",
                                          "C:/data/cartography.gdb/transportation/ilm_polys",
                                          "25000", "", "5 meters", "EXACT_SIMPLIFIED", "", "ALL")
IntersectingLayersMasks example 2 (stand-alone script)

This stand-alone script shows an example of using the IntersectingLayersMasks tool.

# Name: IntersectingLayersMasks_standalone_script.py
# Description: Creates masking polygons at a specified
#              shape and size at the intersections of symbolized features. 
 
# Import system modules
import arcpy

# Set environment settings
arcpy.env.workspace = "C:/data"

# Set local variables
masking_layer = "roads.lyrx"
masked_layer = "buildings_poly.lyrx"
outpuf_fc = "cartography.gdb/transportation/ilm_polys"
reference_scale = "25000"
spatial_reference = arcpy.Describe(masking_layer).spatialReference
margin = "5 Points"
method = "CONVEX_HULL"
mask_for_non_placed_anno = "ALL_FEATURES"
attributes = "ALL"

# Execute Intersecting Layers Masks
arcpy.IntersectingLayersMasks_cartography(masking_layer,
                                          masked_layer,
                                          output_fc,
                                          reference_scale,
                                          spatial_reference,
                                          margin, method,
                                          mask_for_non_placed_anno,
                                          attributes)

Licensing information

  • Basic: No
  • Standard: No
  • Advanced: Yes

Related topics