Apply Visual Specification To Map (Topographic Production)

Summary

Applies symbols and Arcade expressions to layers in a map based on the symbols and rules defined in a visual specification database.

Usage

  • Only specification rules defined using simple SQL expressions for a single feature class and without nested joins will be converted to Arcade. If a specification rule uses complex SQL expressions or Visual Basic expressions, the rule will be skipped and a warning will be generated.

  • A layer in the map will only be updated if the name of the layer matches the layer name defined in one or more specification rules.

  • ArcMap styles containing the representations used in the visual specifications must be converted to a style file (.stylx) before running this tool. For more information, see Import a style into the project.

  • If the tool is run in an ArcGIS Pro project, the style should be imported into the project. If the tool is run from a project, styles associated with the project will be available. Choose a style from the Input Style File parameter or browse to an existing style file.

  • If a visual specification was created using multiple styles, all the symbols used in the specification should be merged to a single style before running this tool.

  • Regardless of the current renderer, if a layer contains specification rules, the layer renderer will be updated to use the Unique Value Renderer. Each specification rule will be added as an Arcade expression with a return code that matches the symbol name of the representation rule. Each return code will be added as a value to the unique value renderer. If the return code matches a symbol name in one of the chosen style files, the value will be displayed with that symbol; otherwise, the value will be displayed with a symbol from the default color ramp.

  • Unlike the ArcMap Calculate Visual Specifications tool, this tool is not intended to be used to apply symbology as each map is created. It is designed to be used as a one-time migration tool to help create map and layout templates in ArcGIS Pro.

Syntax

arcpy.topographic.ApplyVisualSpecificationToMap(in_map, vs_workspace, specification, {in_style_file})
ParameterExplanationData Type
in_map

The map containing layers to which symbols and Arcade expressions will be applied.

Map
vs_workspace

The database containing the visual specification rules.

Workspace
specification

The specification rules that will be converted to Arcade and applied to the map layers.

String
in_style_file
(Optional)

The style file (.stylx) that contains the symbols defined in the visual specification rules.

String

Derived Output

NameExplanationData Type
updated_map

The updated map.

Map

Code sample

ApplyVisualSpecificationToMap example (stand-alone script)

The following stand-alone sample script demonstrates how to use the ApplyVisualSpecificationToMap tool to convert existing Visual Specification rules to Arcade.

# Name: ApplyVisualSpecificationToMap_sample.py
# Description: This tool converts existing Visual Specification rules to Arcade

# 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\TM50.mapx'
vs_workspace = r'C:\Data\TDS_6_1_TM_Visual_Specification.gdb'
specification = "TDS_50K :: 50K TM Visual Specification for TDS 6.1"
in_style_file = r'C:\Data\TM.stylx'

# Calling the Apply Visual Specification To Map to convert existing Visual Specification rules to Arcade
arcpy.topographic.ApplyVisualSpecificationToMap(in_map, vs_workspace, specification, in_style_file)

# Getting all messages, warnings, and errors from the tool run and printing the results back to the user
messages = arcpy.GetMessages(0)
warnings = arcpy.GetMessages(1)
errors = arcpy.GetMessages(2)
arcpy.AddMessage('Tool Messages: {}\nTool Warnings: {}\nTool Errors{}\n'.format(messages, warnings, errors))

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

Environments

This tool does not use any geoprocessing environments.

Licensing information

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

Related topics