Customize maritime symbology

Available with ArcGIS Maritime license.

The Maritime product files include a .cxml file that contains rules adhering to the IHO S-4 specification and Regulations for International Charts and Chart Specifications (INT1). These rules are used by the Apply Maritime Symbology tool to symbolize a paper chart product based on feature attributes. If a hydrographic office wants to use its own variation of nautical chart symbology, the INT1.cxml file can be customized by modifying existing rules or creating rules.

ArcGIS Maritime symbology CXML rules

The sections below include a list of supported CXML operators and best practices for working with the rules.

Note:

The INT1.cxml file defines rules in XML format. Use a third-party program such as Notepad++ to edit the file.

CXML structure for symbols

The rules in the INT1.cxml file are grouped into subtypes for each feature class. The graph below illustrates the hierarchical structure of the CXML. The first level of the XML tree starts with the name of the feature class for which the rules are defined. The level that starts with the subtype number tag indicates the subtypes in the feature class to which the rules should be applied. The level that starts with the condition tag defines the name of the symbol that will be written into the Symbol_C field on a feature. The level that starts with the rule tag defines the attribute condition that must be met for the symbol to be assigned.

<featureClass name = "AidsToNavigationP">
  <subtype number = "1,10">
             <condition ruleid = "0" rulename = "Q90 Stake pole">
                <rule type = "A" field = "BCNSHP" operator = "equal" value = "1"/>
             </condition>
             <condition ruleid = "245" rulename = "Q80 Beacon">
                <rule type = "A" field = "BCNSHP" operator = "equal" value = "1"/>
                <rule type = "A" field = "CATLAM" operator = "equal" value = "1"/>
            </condition>
	</subtype>
<featureClass>

Each feature class can have as many subtype groups and combinations as needed, and each subtype group can have as many rule conditions as needed. The Apply Maritime Symbology tool processes the conditions in order, starting at the top. This means that if you have defined a condition for a feature class at the top, the conditions that follow can override the previous conditions if they apply to the same type of feature.

In the example above, the first condition (in which rulename = "Q90 Stake pole") contains a rule that assigns the Q90 Stake pole symbol to all features in the AidsToNavigationP feature class that are of subtype 1 or 10 and have the beacon shape (BCNSHP) attribute set to 1 (stake, pole, perch, post). The next condition assigns the Q80 Beacon symbol and applies to features that have BCNSHP set to 1 and also have the category of lateral mark (CATLAM) attribute value set to 1 (port-hand lateral mark). The order of these two conditions means that the first condition will assign the Q90 Stake pole symbol to all features with a BCNSHP attribute value of 1 and the second condition will overwrite this symbol with the Q80 Beacon symbol for features that have a BCNSHP field value of 1 and a CATLAM attribute value of 1.

CXML structure for labels

Although CXML format is mainly used for assigning symbols, it also supports Python expressions for generating label strings for a specified field. It is generally recommended that you define and maintain labels using labeling functionality in ArcGIS Pro and save the configuration in the Nautical.lyrx file. However, if the desired label string is too advanced for building it on the layer in ArcGIS Pro, the label can be defined in the .cxml file.

The CXML format supports referencing an external Python script containing the label expression as well as built-in Python expressions. Since the built-in Python expressions require additional formatting, it is recommended that you use the method that references stand-alone Python scripts.

The Python scripts that are referenced for labeling in the file are defined at the top of the CXML tree, under the <functionlibrary> tag. Each Python script is listed with its name for use in the rules (similar to a script parameter) and the actual name of the referenced file. Referenced files can also include the full path to a file; otherwise, the search path includes the following:

  • The folder location of the .cxml file provided for the input parameter
  • The location where the ArcGIS Maritime product files are installed
<?xml version="1.0" encoding="utf-8"?>
<conditionMap name = "INT1" alias = "INT 1" style = "INT1.style">
    <functionLibrary>
		<expressionFile name="LightFunctions">LightFunctions.py</expressionFile>
		<expressionFile name="depth">depth.py</expressionFile>
		<expressionFile name="height">height.py</expressionFile>
		<expressionFile name="horclr">horclr.py</expressionFile>
		<expressionFile name="valsou">valsou.py</expressionFile>
		<expressionFile name="valsou_displaced">valsou_displaced.py</expressionFile>
		<expressionFile name="verclr">verclr.py</expressionFile>
		<expressionFile name="vercop">vercop.py</expressionFile>
		<expressionFile name="verlen">verlen.py</expressionFile>
    </functionLibrary>

Once the Python script file is defined in the function library, it can be referenced in the rules for labeling using the name parameter. In the example below, a labeling rule is created for the CulturalFeaturesP feature class, FCSubtype 60. On the condition level, it defines which field the label string should be parsed to; in this case, it is HEIGHT_TXT. The next level, starting with the expression library tag, references the script file name parameter defined in the function library. The final block, starting with the rule tag, allows you to limit the features that will be included in this labeling rule.

<featureClass name = "CulturalFeaturesP">
   <subtype number = "60">
            <condition type = "2" field = "HEIGHT_TXT">
                <expression library="height"/>
                <rule type = "A" field = "HEIGHT" operator = "notEqual">
                    <value>-32767</value>
                    <value>NULL</value>
                </rule>
            </condition>
   </subtype>

Supported CXML operators

There can be many attribute combinations that drive symbology in a nautical chart. The .cxml file is designed to support the necessary logic operators that enable you to assign the symbol to a feature based on a specific attribute combination.

There are three types of operators: attribute, list, and query. The attribute operators are used with fields that contain a single numeric value. The list operators are used with string fields that can contain multiple values separated by a comma. The query operators are used for querying data on a different, often related feature or a table row to calculate the symbol on the feature being processed.

The supported operators are as follows:

  • Attribute operators: equals, notEquals, lt (less than), lte (less than equals), gt (greater than), gte (greater than equals), between, like, notLike
  • List operators: equals, notEquals, containsAny, containsAll, containsNone, hasMultiple
  • Query operators: exists, fetch

Modify existing CXML rules for symbolizing

Note:

Before making changes to the rules, ensure that you can test your modifications with data containing features that meet the modified rules. For example, you can make a copy of an existing paper chart product to test on or create a test product by importing an S-57 file into a paper chart geodatabase.

Learn more about ArcGIS Maritime data models and creating a paper chart schema in a geodatabase

Complete the following steps to modify rules:

  1. Browse to the Maritime product files <installation location>\ArcGIS Maritime\Product Files\<version>\Charting\Rules and open the INT1.cxml file in an XML document editor (such as Notepad++).
  2. Make a copy of the original INT1.cxml file before making changes in case you need to restore any of the modified rules to the initial configuration.
  3. Collapse all rows to view the list of feature classes, and expand the row for the relevant feature class to find the rule that you want to modify.
  4. Tip:

    Press Ctrl+F to open the Find function, and search for the feature class that contains the rule you want to modify.

    Use the S-57 object finder to identify the FCsubtype value for the S-57 object

  5. Modify the statement as needed using CXML logic operators.
    Note:

    Follow the XML formatting requirements, such as indenting and inserting angle brackets <> correctly when modifying the rules. You can use existing rules and the rule examples included below as guidance for syntax and structure.

    Include comments to new or modified rules to document changes to the .cxml file. Start a comment with <!-- and close the comment with -->.

  6. Save the edits.
  7. Run the Apply Maritime Symbology tool on your test data to verify that the modified rules produce the desired results.

Create a CXML rule for assigning a symbol

Note:

Before making changes to the rules, ensure that you can test your modifications with data containing features that meet the modified rules. For example, you can make a copy of an existing paper chart product to test on or create a test product by importing an S-57 file into a paper chart geodatabase.

Learn more about ArcGIS Maritime data models and creating a paper chart schema in a geodatabase

Complete the following steps to create a rule:

  1. Browse to the Maritime product files <installation location>\ArcGIS Maritime\Product Files\<version>\Charting\Rules and open the INT1.cxml file in an XML document editor (such as Notepad++).
  2. Make a copy of the original INT1.cxml file before making changes in case you need to restore any of the modified rules to the initial configuration.
  3. Use the + button to expand or collapse sections as needed to locate the FCsubtype (feature class subtype) for the new rule.
  4. Tip:

    Press Ctrl+F to open the Find function, and search for the feature class that contains the rule you want to modify.

    If you can’t find an existing FCsubtype in which you want to create a rule, you can add a new row with the FCsubtype that you need. Be aware of the rule order and determine whether the rule should be applied first (higher in the list of rules) or later (lower in the list of rules). Keep in mind that some rules are purposefully written to overwrite the results of others due to their order.

    Use the S-57 object finder to identify the FCsubtype value for the S-57 object

  5. Use the logic operators or the rule examples to create a rule in the appropriate FCsubtype.
    Keep the following in mind:
    • The ruleid tag has no impact on the functionality. You may choose the ID value of your choice.
    • For the rule name tag, copy the exact symbol name from the INT1.stylx file found in the Maritime product files. The rule name must match the symbol classes configured in the Symbology pane; otherwise, symbols will appear red.
    • If necessary, you can insert a rule element to limit the features to which the symbol will be assigned.
  6. Save the edits.
  7. Run the Apply Maritime Symbology tool on your test data to verify that the new rules produce the desired results.

Create a rule for labeling

Note:

Before making changes to the rules, ensure that you can test your modifications with data containing features that meet the modified rules. For example, you can make a copy of an existing paper chart product to test on or create a test product by importing an S-57 file into a paper chart geodatabase.

Learn more about ArcGIS Maritime data models and creating a paper chart schema in a geodatabase

Complete the following steps to create a labeling rule:

  1. In ArcGIS Pro, create a field on the feature class for storing the new label string.
  2. Using a Python editor, create a label expression that you will reference in the .cxml file.
    Note:
    Refer to Expression examples for guidance on how to build Python label expressions.
  3. Save the Python script in the same folder as the INT1.cxml file or where the ArcGIS Maritime Pro product files are installed. Otherwise, you must include the full path to the file when referencing the script file in the function library.
  4. Browse to the Maritime product files <installation location>\ArcGIS Maritime\Product Files\<version>\Charting\Rules and open the INT1.cxml file in an XML document editor (such as Notepad++).
  5. Make a copy of the original INT1.cxml file before making changes in case you need to restore any of the modified rules to the initial configuration.
  6. In the .cxml file, add a reference to the new Python script to the <functionLibrary>. For syntax examples, refer to CXML structure for labels section above.
  7. Use the + button to expand or collapse sections as needed to locate the FCsubtype (feature class subtype) for the new rule.
  8. Tip:
    Press Ctrl+F to open the Find function, and search for the feature class for which the labeling rule needs to be created.

    Use the S-57 object finder to identify the FCsubtype value for the S-57 object

  9. Once you have determined the location where you want to insert a new rule for labelling, use the logic operators or the rule examples to create a rule.
    Keep the following in mind:
    • The type property value at the condition tag level must be set to 2.
    • The field property must match the exact name of the new field that you created. The CXML will parse the label string into this field.
    • The property value defined in the expression library tag must match the exact Python script name parameter.
    • If necessary, you can insert a rule element to limit the features for which the label string will be generated.
    <condition type = "2" field = "HEIGHT_TXT">
    		<expression library="height"/>
             <rule type = "A" field = "HEIGHT" operator = "notEqual">
                   <value>-32767</value>
                   <value>NULL</value>
              </rule>
    </condition>
  10. Save the edits.
  11. Run the Apply Maritime Symbology tool on your test data to verify that the new rules parse the desired label string into the defined field.
  12. If necessary, configure the label placement for the new label string.

Rule examples

The following are examples of common rule cases using CXML logic operators:

Assign a symbol to a feature in which only one field must meet a specific attribute condition

In the example below, a rule type A (attribute) is used together with the equals operator. This rule for AidsToNavigationP will assign symbol Q90 Stake pole to features that have a BCNSHP attribute value set to 1.

<condition ruleid = "0" rulename = "Q90 Stake pole">
     <rule type = "A" field = "BCNSHP" operator = "equals" value = "1"/>
</condition>

Assign a symbol to a feature in which two or more fields must meet a specific attribute condition

In the example below, a rule type A (attribute) is used together with the equals operator for the first field, CATLND. The second line adds an additional requirement for the INFORM field that must contain the string Sabkha. This rule for NaturalFeaturesA will assign symbol C24c Sabkha to features that have the CATLND attribute value set to 15 and contains the string *Sabkha* in the INFORM field.

<condition ruleid = "0" rulename = "C24c Sabkha">
     <rule type = "A" field = "CATLND" operator = "equals" value = "15"/>
     <rule type = "A" field = "INFORM" operator = "like" value = "*Sabkha*"/>            
</condition>

Assign a symbol to a feature in which a list field must meet a specific attribute condition

A list field is a string field that can contain many values separated by a comma. In the example below, a rule type L (list) is used together with the operator containsAny. This rule for NaturalFeaturesA will assign symbol C33b Swamp Marsh to features if one of the values in the CATLND field is 2.

<condition ruleid = "0" rulename = "C33b Swamp Marsh">
     <rule type = "L" field = "CATLND" operator = "containsAny" value = "2"/>
</condition>

Assign a symbol to a feature in which a field contains one of the values listed in the rule

In the example below, a rule type A (attribute) is used together with the equals operator for the CATCOA field. This rule for CoastlineL will assign symbol C7 Coastline rubble to features that have CATCOA set to 4 or 5.

<condition ruleid = "0" rulename = "C7 Coastline rubble">
     <rule type = "A" field = "CATCOA" operator = "equals">
         <value>4</value>
         <value>5</value>
     </rule>
</condition>

Assign a symbol to a feature in which two or more fields must meet a specific attribute condition for a range

In the example below, a rule type A (attribute) is used together with the operators gte, gt, lt, and lte to define specific intervals for the fields DRVAL1, DRVAL2, and PLTS_COMP_SCALE. This rule for DepthsA will assign symbol I30 Depth area 0-10m/0-60ft to features in which the DRVAL1 value is greater than or equal to 0, the DRVAL2 value is greater than 0 and less than or equal to 5, and the PLTS_COMP_SCALE is less than 20,000.

<condition ruleid = "000" rulename = "I30 Depth area 0-10m/0-60ft">
    <rule type = "A" field = "DRVAL1" operator = "gte" value = "0"/>
    <rule type = "A" field = "DRVAL2" operator = "gt" value = "0"/>
    <rule type = "A" field = "DRVAL2" operator = "lte" value = "5"/>
    <rule type = "A" field = "PLTS_COMP_SCALE" operator = "lt" value = "20000"/>
</condition>

Assign a symbol to all features within a subtype regardless of the attribute combination

In the example below, no rules are defined for assigning the specific symbol. The S5 Radar-conspicuous feature symbol will be assigned to all AidsToNavigationP features within the FCSubtype 85.

<subtype number = "85">
    <condition ruleid = "256" rulename = "S5 Radar-conspicuous feature"></condition>
</subtype>

Assign a symbol to a feature based on one or multiple values in another table

In the example below, the rule type Q (query) is used to retrieve information from the PLTS_FREL table to assign the symbol for a feature in the AidsToNavigationP feature class. The S1 Ra transponder bn - w/light symbol will be assigned to the features in the AidsToNavigationP feature class that are equipment features on one of the structure features listed in the query. The query function uses the LNAM as a parameter to identify the structure-equipment entry in the PLTS_FREL table for the particular feature being processed in AidsToNavigationP.

<condition ruleid = "255" rulename = "S1 Ra transponder bn - w/light">
       <rule type = "Q" table = "PLTS_FREL" query = "DEST_LNAM= '%s' AND SRC_SUB IN ('LNDMRK_Landmark', 'BCNCAR_BeaconCardinal',  'BCNISD_BeaconIsolatedDanger', 'BCNLAT_BeaconLateral', 'BCNSAW_BeaconSafeWater', 'BCNSPP_BeaconSpecialPurpose', 'BOYCAR_BuoyCardinal', 'BOYINB_BuoyInstallation', 'BOYISD_BuoyIsolatedDanger', 'BOYLAT_BuoyLateral', 'BOYSAW_BuoySafeWater', 'BOYSPP_BuoySpecialPurpose', 'LIGHTS_Light', 'LITFLT_LightFloat', 'LITVES_LightVessel')" operator = "exists">
            <params>
                <param value = "LNAM"/>
            </params>
       </rule>
</condition>