Rule files for masking
Available with an ArcGIS Topographic Mapping license.
Predefined XML masking rule files that can be used for cartographic production are included in a product data file installer for ArcGIS Topographic Mapping product files.
The XML files define the rules that decide how polygon masks are created based on matching colors.
The following XML example demonstrates the basic structure of a rule file:
<?xml version="1.0" encoding="utf-8"?>
<ColorRules>
<MaskFeatureClasses>
<SourceFields>
<Field type="esriFieldTypeString" length="255">MapId_Txt</Field>
</SourceFields>
<TargetFields>
<Field type="esriFieldTypeString" length="255">F_CODE</Field>
</TargetFields>
<MaskFeatureClass>
<Name>AnnoMasks_NonBlack</Name>
<LayerName>NonBlack Masks</LayerName>
<OverwriteOutput>DeleteAndAppend</OverwriteOutput>
<AddToMap>False</AddToMap>
</MaskFeatureClass>
</MaskFeatureClasses>
<RuleGroup>
<Mask Size=".2" Units="Millimeters" Type="Exact_Simplified" Simplify=".05"/>
<Source SymbolPart="Text_Only" LayerType="AnnotationLayer" ColorSpace="CMYK"/>
<Target SymbolPart="Outline_Only" LayerType="FeatureLayer" ColorSpace="CMYK"/>
<TargetExclusions></TargetExclusions>
<SourceExclusions></SourceExclusions>
<Rules>
<Rule Name="NonBlack_2mm">
<MaskFeatureClass>
AnnoMasks_NonBlack
</MaskFeatureClass>
<Source Color="100,20,30,0"/>
<Targets GeometryType="line,polygon">
<Target Color="100,20,30,0"/>
<Target Color="0,0,0,100" />
</Targets>
<TargetExclusions>
ContourL,SEG*
</TargetExclusions>
</Rule>
</Rules>
</RuleGroup>
</ColorRules>
MaskFeatureClasses element
The optional MaskFeatureClasses element is a child element of the ColorRules element. Using the MaskFeatureClasses element, you can define properties for the feature classes that contain the mask polygons. If MaskFeatureClasses is not defined, you can use the Make Masks From Rules tool to create mask feature classes using the default schema.
The following table contains details for the MaskFeatureClasses element:
MaskFeatureClasses
|
Element |
Details |
|---|---|
|
|
Specifies attributes from the source feature found by a given rule that will be included in the final mask feature class. |
|
|
Specifies attributes from the target feature found by a given rule that will be included in the final mask feature class. |
|
|
This element has a type attribute that takes the string value of the Note:The length attribute is only for a string field. |
|
|
The section below contains details about the |
Note:
The fields specified in SourceFields and TargetFields should exist on all layers in the map. The field name is prefixed with Source_ or Target_ in the final mask feature class. If the rule file is configured to append masks to an existing feature class, SourceFields and TargetFields must already exist on the feature class. The Make Masks From Rules tool does not modify the schema of an existing feature class.
MaskFeatureClass element
The MaskFeatureClass child element defines a feature class that contains mask polygons. You can define as many of the MaskFeatureClass elements as necessary. The SourceFields and TargetFields elements apply to all MaskFeatureClass elements defined in MaskFeatureClasses.
The following table contains details for the MaskFeatureClass element:
MaskFeatureClass
|
Element |
Details |
|---|---|
|
|
The name of the feature class. Use this name to reference the feature class in a |
|
|
The layer name that will be used when adding the mask feature class to the map as a layer. If you don't provide a name, |
|
|
Specifies whether the output will be overwritten. The options are as follows:
|
|
|
Specifies whether the mask feature class will be added to the map as a layer. The options are as follows:
|
RuleGroup element
Elements defined at the RuleGroup level apply to all Rule elements in the RuleGroup element unless a Rule element overrides it by specifying a different value.
The following RuleGroup example defines an Exact Simplified mask with a size of .2 millimeters. It defines the common Source and Target element attributes of SymbolPart, LayerType and ColorSpace that likely apply to most Rule elements in the group.
<RuleGroup>
<Mask Size=".2" Units="Millimeters" Type="Exact_Simplified" Simplify=".05"/>
<Source SymbolPart="Text_Only" LayerType="AnnotationLayer" ColorSpace="CMYK"/>
<Target SymbolPart="Outline_Only" LayerType="FeatureLayer" ColorSpace="CMYK"/>
</RuleGroup>
Rule element
The attributes in the following Rule element example override values specified in attributes defined in a RuleGroup element. This example overrides mask size and mask type attribute values in the aforementioned RuleGroup example. The source also matches feature layers instead of annotation layers, and the fill symbol in the RGB color space is now targeted.
<Rule>
<Mask Size=".5" Units="Millimeters" Type="Convex_Hull" Style="BufferFeature"/>
<Source Color="100,20,30,0 LayerType=”FeatureLayer"/>
<Targets>
<Target Color="198,59,59" ColorSpace=”RGB” SymbolPart=”Fill_Only”/>
</Targets>
</Rule>
Mask element attributes
The following table contains details for the Mask element attributes:
Mask element attributes
|
Attribute |
Details |
|---|---|
|
|
The size of the mask that will be created. |
|
|
Specifies the size units. The following values are valid: |
|
|
Specifies the type of mask. The following values are valid: |
|
|
The simplification tolerance on the resulting masks. This attribute is not required. |
|
|
Specifies whether source and target features will be buffered or intersection masks will be buffered. This can help improve performance, particularly in scenarios with dense features. Values:
Note:The |
The following table contains details for the elements and attributes of a Rule element:
Element attributes
|
Element or attribute |
Details |
|---|---|
|
|
The color that will be used to match in the layer symbol. This is a comma-separated set of numbers that correspond to the Alternatively, when an asterisk is placed in the |
|
|
The color model that will be used. You can define this at the |
|
|
Specifies the symbol part in the symbolized layer that will be used when matching the color. The following values are valid: |
|
|
Specifies the types of layers that will be included when matching a color. The following values are valid: |
|
|
Specifies the comma-delimited list of geometry types to which a layer applies. If no value is specified, all geometry types will match. The following values are valid: |
|
|
The comma-delimited list of layer names that will be matched. The source or target color only matches using these layers. If no value is specified, all layers will match. This attribute can be applied to the |
|
|
The The following is an example:
|
|
|
The |
|
|
The target layers that will be excluded when matching source layers to target layers. Layers that you provide will not have a mask created or applied. A comma-delimited list of layer names is valid. This attribute is optional. |
|
|
The source layers that will be excluded from the masking rule. Layers that you provide will not have a mask created or applied. A comma-delimited list of layer names is valid. |
|
|
The alternate color that will be used to match in the layer symbol. This is a comma-separated set of numbers that correspond to the value set by the For example, if the |
|
|
The name of the color in the feature's symbology. |
|
|
Specifies how marker fill within a polygon is masked. For example, Other options include:
|
Wildcards
Wildcards can be used in the following elements and attributes: LayerNames, TargetExclusions, and SourceExclusions. The following table provides details for the wildcard symbols:
|
Symbol |
Name |
Details |
|---|---|---|
|
|
Asterisk |
Including an asterisk in a value matches any number of characters. For example, |
|
|
Question mark |
Including a question mark in a value matches any single character in the position of the question mark. For example, |
|
|
Brackets |
Including brackets in a value matches the same characters specified between the brackets. For example, |
|
|
Caret |
Using a caret inside of brackets excludes characters. For example, |
|
|
Pound |
Including a pound symbol in a value matches a single numeric character in the position of the pound symbol. For example, |