Features To Graphics (Conversion)

Summary

Converts a feature layer's symbolized features into graphic elements in a graphics layer.

Usage

  • Symbolized features are converted to graphic elements using the geometry of the feature and the symbol from the layer's symbology.

  • This tool is commonly used to convert only a subset (selection) of features to graphics.

  • Use the Exclude converted features from drawing parameter to exclude converted features from the Input Features parameter value from drawing so that only graphic elements draw in their location. To redraw converted features, view the feature layer's properties and check the exclusion setting on the Selection tab.

  • This tool does not support batch geoprocessing.

Parameters

LabelExplanationData Type
Input Features

The layer to convert to graphics.

Feature Layer
Output Graphics Layer

The graphics layer containing the converted graphic elements.

Graphics Layer
Exclude converted features from drawing
(Optional)

Specifies whether the converted features will be excluded using a query.

  • Checked—The features will be excluded. This is the default.
  • Unchecked—The features will not be excluded; they will be preserved.

Boolean

Derived Output

LabelExplanationData Type
Updated layer

The updated input layer. The layer will contain the update of the exclusion set if the Exclude converted features from drawing parameter is checked.

Feature Layer

arcpy.conversion.FeaturesToGraphics(in_layer, out_layer, {exclude_features})
NameExplanationData Type
in_layer

The layer to convert to graphics.

Feature Layer
out_layer

The graphics layer containing the converted graphic elements.

Graphics Layer
exclude_features
(Optional)

Specifies whether the converted features will be excluded using a query.

  • EXCLUDE_FEATURESThe features will be excluded. This is the default.
  • KEEP_FEATURESThe features will not be excluded; they will be preserved.
Boolean

Derived Output

NameExplanationData Type
updated_layer

The updated input layer. The layer will contain the update of the exclusion set if the exclude_features parameter is set to EXCLUDE_FEATURES.

Feature Layer

Code sample

FeaturesToGraphics example 1 (Python window)

The following Python snippet converts a point feature layer to a graphics layer from the Python window.

import arcpy
arcpy.env.workspace = r"C:/data/input/pointFeatures.lyrx"
arcpy.conversion.FeaturesToGraphics("pointFeatures", "pointGraphics", "KEEP_FEATURES")
FeaturesToGraphics example 2 (stand-alone script)

The following Python snippet converts a feature selection of New York City boroughs from a New York state counties feature layer into a graphics layer containing polygon graphic elements. The result excludes the converted graphics from the original feature layer.

# Name: FeaturesToGraphics.py
# Description: Converts a polygon feature layer to polygon graphics.
# Requirements: None

# Import system models
import arcpy

# Set the workspace
arcpy.env.workspace = r"C:\data\input"

# Set local variables
out_layer = "NYBoroughs"
myquery = "AREATYPE = 'Borough'"

# Select the features to convert
in_layer = arcpy.management.SelectLayerByAttribute("NYCounties", 
                                                   "NEW_SELECTION", myquery)

# Run FeaturesToGraphics
arcpy.conversion.FeaturesToGraphics(in_layer, out_layer, "EXCLUDE_FEATURES")

Related topics