from qgis.core import QgsWkbTypes # Create a WKB type wkb_type = QgsWkbTypes.Polygon # Get the string representation of the WKB type display_string = QgsWkbTypes.displayString(wkb_type) # Print the display string print(display_string) # Output: 'Polygon'
from qgis.core import QgsWkbTypes # Loop through all available WKB types for wkb_type in QgsWkbTypes.types(): display_string = QgsWkbTypes.displayString(wkb_type) print(f"WKB Type: {wkb_type}, Display String: {display_string}")In this example, we import the QgsWkbTypes class and loop through all available WKB types by calling the `types` method on the QgsWkbTypes class. For each WKB type, we call `displayString` to get the string representation of the type and print out both the WKB type and its corresponding display string. This example is useful when trying to understand the different WKB types and their corresponding string representations. The package/library used in this example is the QGIS core library for Python.