# Convert 5 meters to feet from qgis.core import QgsUnitTypes source_unit = QgsUnitTypes.DistanceMeters destination_unit = QgsUnitTypes.DistanceFeet value = 5 factor = QgsUnitTypes.fromUnitToUnitFactor(source_unit, destination_unit) converted_value = value * factor print(f"{value} {QgsUnitTypes.unitTypeToString(source_unit)} = {converted_value} {QgsUnitTypes.unitTypeToString(destination_unit)}")In this example, we convert the value 5 meters to feet using the fromUnitToUnitFactor method. We specify the source unit as DistanceMeters and the destination unit as DistanceFeet. The conversion factor is calculated and used to multiply the source value of 5 meters, resulting in a converted value of 16.404 feet. This package library is a part of the QGIS Python API.