mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
util/geolocation.py fix imports and dms2dd
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
|
import math
|
||||||
|
|
||||||
def dms2dd(degrees, minutes, seconds, milliseconds=0):
|
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
|
return dd
|
||||||
|
|
||||||
def dd2dms(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):
|
def xyz2enh(x, y, z, eastings, northings, orthogonal_height, x_axis_abscissa, x_axis_ordinate, scale=None):
|
||||||
if scale is None:
|
if scale is None:
|
||||||
scale = 1.
|
scale = 1.
|
||||||
rotation = atan2(x_axis_ordinate, x_axis_abscissa)
|
rotation = math.atan2(x_axis_ordinate, x_axis_abscissa)
|
||||||
a = scale * cos(rotation)
|
a = scale * math.cos(rotation)
|
||||||
b = scale * sin(rotation)
|
b = scale * math.sin(rotation)
|
||||||
eastings = (a * x) - (b * y) + eastings
|
eastings = (a * x) - (b * y) + eastings
|
||||||
northings = (b * x) + (a * y) + northings
|
northings = (b * x) + (a * y) + northings
|
||||||
height = z + orthogonal_height
|
height = z + orthogonal_height
|
||||||
|
|||||||
Reference in New Issue
Block a user