ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Hilfe
  • Sign Out
ArcGIS Desktop

ArcGIS Online

Die Mapping-Plattform für Ihre Organisation

ArcGIS Desktop

Ein vollständiges professionelles GIS

ArcGIS Enterprise

GIS in Ihrem Unternehmen

ArcGIS Developers

Werkzeuge zum Erstellen standortbezogener Apps

ArcGIS Solutions

Kostenlose Karten- und App-Vorlagen für Ihre Branche

ArcGIS Marketplace

Rufen Sie Apps und Daten für Ihre Organisation ab.

  • Dokumentation
  • Support
Esri
  • Anmelden
user
  • Eigenes Profil
  • Abmelden

ArcMap

  • Startseite
  • Erste Schritte
  • Karte
  • Analysieren
  • Verwalten von Daten
  • Werkzeuge
  • Erweiterungen

StyleItem

  • Zusammenfassung
  • Auswertung
  • Eigenschaften
  • Codebeispiel

Zusammenfassung

Provides access to StyleItem class properties.

Auswertung

The symbols you choose to display features, elements, or graphics in your map are stored in style files (.style). You use the Style Manager dialog box to create, view, and modify styles and their contents. Styles are organized into a defined set of categories or folder names, for example, Colors, Legend Items, Marker Symbols, and Scale Bars. Individual style items are stored in each category or folder name. For example, the Legend Items folder name has several different legend item style items, and each item has a different format, font size, and font type for the different elements that are displayed for a legend item.

The StyleItem class was introduced to serve a basic arcpy.mapping requirement to provide the ability to update legend item style items with custom settings. In the user interface, when you add a new layer to the table to contents, and that feature is automatically added to the legend, a default style is applied. The arcpy.mapping module allows you to update the individual legend item style items in a LegendElement on a page layout. This can be accomplished using the following workflow.

  • Author a custom legend item style item using the Style Manager.
  • Reference the custom legend item style item using the ListStyleItems function.
  • Reference the legend element using the ListLayoutElements function.
  • Update a specific legend item style item in the legend using the updateItem method on the LegendElement class.

Eigenschaften

EigenschaftErklärungDatentyp
itemName
(Nur lesen)

A string that represents the name of the item the way it appears in the Style Manager dialog box window.

String
itemCategory
(Nur lesen)

A string that represents the category of the item the way it appears in the Style Manager dialog box window. Categories are used to group symbols within a style.

String
styleFolderName
(Nur lesen)

A string that represents the name of the folder the StyleItem is stored in, for example, Legend Items. Identifying the styleFolderName allows you to determine the type of the style object you have referenced.

String

Codebeispiel

StyleItem example

The following script uses the workflow outlined above and updates a legend's legend item style item. A layer is added to the first data frame in the map document and the legend item style item will be updated with a custom legend item style item called NewDefaultLegendStyle. The custom .style file is saved in the user's profile location.

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyrFile = arcpy.mapping.Layer(r"C:\Project\Data\Rivers.lyr")
arcpy.mapping.AddLayer(df, lyrFile, "TOP")
lyr = arcpy.mapping.ListLayers(mxd, 'Rivers', df)[0]
styleItem = arcpy.mapping.ListStyleItems("USER_STYLE", "Legend Items", "NewDefaultLegendStyle")[0]
legend = arcpy.mapping.ListLayoutElements(mxd, "LEGEND_ELEMENT")[0]
legend.updateItem(lyr, styleItem)
del mxd

ArcGIS Desktop

  • Startseite
  • Dokumentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

Über Esri

  • Über uns
  • Karriere
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Wir sind an Ihrer Meinung interessiert.
Copyright © 2021 Esri. | Datenschutz | Rechtliches