From 8fe4eb1dba1b20866faa1e39eaf36cecff891c7e Mon Sep 17 00:00:00 2001 From: carlopav Date: Sun, 17 May 2020 12:20:36 +0200 Subject: [PATCH] util/geolocation.py fix imports and dms2dd --- .../ifcopenshell/util/geolocation.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/geolocation.py b/src/ifcopenshell-python/ifcopenshell/util/geolocation.py index 53fc034e9c..1ac2578152 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/geolocation.py +++ b/src/ifcopenshell-python/ifcopenshell/util/geolocation.py @@ -1,5 +1,7 @@ +import math + def dms2dd(degrees, minutes, seconds, milliseconds=0): - dd = float(degrees) + float(minutes)/60 + float(seconds)/(3600) + dd = float(degrees) + float(minutes)/60 + float(seconds)/(3600) + float(milliseconds/3600000) return dd def dd2dms(dd): @@ -15,9 +17,9 @@ def dd2dms(dd): def xyz2enh(x, y, z, eastings, northings, orthogonal_height, x_axis_abscissa, x_axis_ordinate, scale=None): if scale is None: scale = 1. - rotation = atan2(x_axis_ordinate, x_axis_abscissa) - a = scale * cos(rotation) - b = scale * sin(rotation) + rotation = math.atan2(x_axis_ordinate, x_axis_abscissa) + a = scale * math.cos(rotation) + b = scale * math.sin(rotation) eastings = (a * x) - (b * y) + eastings northings = (b * x) + (a * y) + northings height = z + orthogonal_height