From b3f9599de4f594a6cf3f12982d9f611dd7ab0334 Mon Sep 17 00:00:00 2001 From: KatKatKateryna Date: Wed, 5 Jun 2024 17:34:20 +0100 Subject: [PATCH] Revert "remove specklepy call in helpers" This reverts commit de002e07f095db88b284cfc0ca4fddad8fa09966. --- plugin_utils/helpers.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/plugin_utils/helpers.py b/plugin_utils/helpers.py index 9bd45b1..325ce3a 100644 --- a/plugin_utils/helpers.py +++ b/plugin_utils/helpers.py @@ -5,6 +5,8 @@ from textwrap import wrap import inspect from difflib import SequenceMatcher +from specklepy.objects.units import get_units_from_string + SYMBOL = "_x_x_" UNSUPPORTED_PROVIDERS = ["WFS", "wms", "wcs", "vectortile"] @@ -31,13 +33,8 @@ def get_scale_factor(units: str, dataStorage) -> float: return scale_to_meter -def get_scale_factor_to_meter(units) -> float: - if not isinstance(units, str): - try: - units = units.value - except: - units = str(units) - units = units.lower() +def get_scale_factor_to_meter(units_src: str) -> float: + units = str(get_units_from_string(units_src)) try: unit_scale = { "meters": 1.0,