Make Masks From Rules (Topographic Production)

Available with Production Mapping license.

Summary

Creates polygon masks for features based on color rules.

Note:

A product file installer is available for ArcGIS Production Mapping and ArcGIS Defense Mapping. The product files contain predefined XML masking rule files that can be used for cartographic production.

Learn more about Defense Mapping product files and Production Mapping product files.

Usage

  • This tool will process the rule file and for each rule, identify the intersection of symbolized features based on the colors or symbol parts defined in the rule. It will create a masking polygon at the intersection of the symbolized features. The rule file allows for storing masks in multiple feature classes.

  • The color rules are defined in an .xml file. A rule specifies that symbolized features of a particular color be masked by a source feature that has a particular color.

    The following example rule is based on a map specification in which a mask will be created for any location where the outline of a black symbol (color of 0,0,0,100 CMYK) intersects a piece of black annotation.

    
    <RuleGroup>
            <!-- CMYK Feature Masks -->
            <Mask Size=".1" Units="Points" Type="Box"/>
            <Source SymbolPart="Text_Only" LayerType="AnnotationLayer"/>
            <Target SymbolPart="Outline_Only" LayerType="FeatureLayer"/>
            <TargetExclusions></TargetExclusions>
            <Rules>
                <Rule Name="FeatureMasks_Black_CMYK_1pt">
                    <MaskFeatureClass>FeatureMasks_Black_CMYK_1pt</MaskFeatureClass>
                    <Source Color="0,0,0,100"/>
                    <Targets>
                        <Target Color="0,0,0,100"/>
                    </Targets>
                </Rule>
            </Rules>
    </RuleGroup>
  • The size of the mask that will be generated is dependent on the map scale. Ensure that you have set an appropriate reference scale on the map or zoomed the map to the desired scale. The scale should match the scale of the output product to which the mask will be applied.

  • When creating masks for annotation layers, create the annotation at the same scale as the output product.

  • The projection of the map should match the projection of the output product to which the masks will be applied. If the mask features will be stored in an existing feature dataset, the coordinate system of the feature dataset should match the projection of the output product.

  • Ensure that the output feature dataset does not contain any data that the Input Map parameter value is using as a source, such as map layer data.

  • The MaskFeatureClass tag in the mask .xml file determines the name of the mask feature class that will be created. If a feature class with the same name already exists in the database chosen for the output feature dataset, the feature class will be deleted and re-created. Masks will not be appended to existing feature classes.

  • Masks will be created for all layers in the chosen map that have symbol parts that use the specified colors. To prevent masks from being created for a specific layer, add the name of the layer to the Target Exclusions tag.

Parameters

LabelExplanationData Type
Input Map

The map containing symbolized features.

Map
Rule File

The .xml file containing rules that define how features will be masked based on colors and symbol parts.

File
Output Feature Dataset

The output feature dataset. The tool will create a feature dataset containing polygon feature classes that will be used for masking. The spatial reference for the feature dataset will be taken from the map for which masks are generated.

Feature Dataset

arcpy.topographic.MakeMasksFromRules(in_map, rule_file, out_feature_dataset)
NameExplanationData Type
in_map

The map containing symbolized features.

Map
rule_file

The .xml file containing rules that define how features will be masked based on colors and symbol parts.

File
out_feature_dataset

The output feature dataset. The tool will create a feature dataset containing polygon feature classes that will be used for masking. The spatial reference for the feature dataset will be taken from the map for which masks are generated.

Feature Dataset

Code sample

MakeMasksFromRules example (stand-alone script)

The following stand-alone script demonstrates how to create masks for annotation features based on the rules defined in the rule .xml file.

# Name: MakeMasksFromRules_sample.py
# Description: This script creates masks for annotation features based on the rules defined in the rule xml file

# Import System Modules
import arcpy

# Check Out Extensions
arcpy.CheckOutExtension('Foundation')

# Setting the environment
arcpy.env.overwriteOutput = True

# Setting Local Variables
in_map = r'C:\Data\NewZealandHistoricBuildings.mapx'
rule_file = r'C:\Data\NewZealandHistoricBuildingAnno_Masking_Rules.xml'
out_feature_dataset = r'C:\Data\Label_your_map.gdb\Masks'

# Calling the Make Masks From Rules to create mask features for the annotation features defined in the rule_file
arcpy.topographic.MakeMasksFromRules(in_map, rule_file, out_feature_dataset)

# Check In Extension
arcpy.CheckInExtension('Foundation')

Environments

Licensing information

  • Basic: No
  • Standard: Requires Production Mapping
  • Advanced: Requires Production Mapping

Related topics