The multiType feature in QgsWkbTypes of the QGIS Python library allows for the creation of geometries with multiple types of coordinates. For example, a geometry containing both line and point coordinates.
#Example 1: Creating a multiType geometry with a line and a point from qgis.core import QgsGeometry, QgsWkbTypes
# Create a line geometry line = QgsGeometry.fromPolyline([(0,0),(4,4)])
# Create a point geometry point = QgsGeometry.fromPointXY((2,2))
# Merge the line and point into a multiType geometry multi_type = QgsGeometry.fromMultiType([line, point])
#Example 2: Check if a geometry is multiType from qgis.core import QgsGeometry, QgsWkbTypes
# Create a point geometry point = QgsGeometry.fromPointXY((2,2))
# Check if the geometry is multiType is_multi_type = QgsWkbTypes.isMultiType(point.wkbType())
# Print the result print(is_multi_type) # False
In both examples, we import the required packages from the QGIS Python library. The first example creates a multiType geometry by merging a line and a point. The second example checks if a geometry is multiType.
The package library used is qgis.core.
Python QgsWkbTypes.multiType - 38 examples found. These are the top rated real world Python examples of qgis.core.QgsWkbTypes.multiType extracted from open source projects. You can rate examples to help us improve the quality of examples.