diff --git a/src/coordinate_transformation_api/constants.py b/src/coordinate_transformation_api/constants.py index 514c0d5..a4fcd54 100644 --- a/src/coordinate_transformation_api/constants.py +++ b/src/coordinate_transformation_api/constants.py @@ -1,5 +1,5 @@ -DEFAULT_PRECISION = 4 -HEIGHT_PRECISION = ( +DEFAULT_DIGITS_FOR_ROUNDING = 4 +HEIGHT_DIGITS_FOR_ROUNDING = ( 4 # height will always be in metres, therefor fixed precision of 4 decimals ) DENSIFY_CRS_2D = "EPSG:9067" diff --git a/src/coordinate_transformation_api/crs_transform.py b/src/coordinate_transformation_api/crs_transform.py index e50aa9e..28faeb1 100644 --- a/src/coordinate_transformation_api/crs_transform.py +++ b/src/coordinate_transformation_api/crs_transform.py @@ -19,8 +19,8 @@ from coordinate_transformation_api import assets from coordinate_transformation_api.constants import ( - DEFAULT_PRECISION, - HEIGHT_PRECISION, + DEFAULT_DIGITS_FOR_ROUNDING, + HEIGHT_DIGITS_FOR_ROUNDING, THREE_DIMENSIONAL, TWO_DIMENSIONAL, ) @@ -41,8 +41,8 @@ def get_precision(target_crs_crs: MyCrs) -> int: unit = target_crs_crs.get_x_unit_crs() if unit == "degree": - return DEFAULT_PRECISION + 5 - return DEFAULT_PRECISION + return DEFAULT_DIGITS_FOR_ROUNDING + 5 + return DEFAULT_DIGITS_FOR_ROUNDING def get_shapely_objects( @@ -376,13 +376,13 @@ def transform_compound_crs(val: CoordinatesType) -> tuple[float, ...]: h = tuple( [ - float(my_round(x, DEFAULT_PRECISION)) + float(my_round(x, DEFAULT_DIGITS_FOR_ROUNDING)) for x in h_transformer.transform(*input) ] ) v = tuple( [ - float(my_round(x, HEIGHT_PRECISION)) + float(my_round(x, HEIGHT_DIGITS_FOR_ROUNDING)) for x in v_transformer.transform(*input) ] ) @@ -433,7 +433,7 @@ def transform_crs(val: CoordinatesType) -> tuple[float, ...]: ) if len(output) >= THREE_DIMENSIONAL: - height = my_round(output[2:3][0], HEIGHT_PRECISION) + height = my_round(output[2:3][0], HEIGHT_DIGITS_FOR_ROUNDING) return output[0:2] + tuple( [height], )