compute sphere coordinates

pull/1/head
Konstantin Gründger 2015-11-15 01:16:19 +01:00
rodzic 11c3377f96
commit 1d49a3417b
1 zmienionych plików z 14 dodań i 1 usunięć

Wyświetl plik

@ -1,5 +1,5 @@
import unittest
from ogn.ognutils import get_ddb, get_country_code
from ogn.ognutils import get_ddb, get_country_code, wgs84_to_sphere
from ogn.model.address_origin import AddressOrigin
@ -33,3 +33,16 @@ class TestStringMethods(unittest.TestCase):
longitude = -0.0009119
country_code = get_country_code(latitude, longitude)
self.assertEqual(country_code, None)
def test_wgs84_to_sphere(self):
lat1 = 48.74435
lon1 = 9.578
alt1 = 929
lat2 = 48.865
lon2 = 9.2225
alt2 = 574
[radius, theta, phi] = wgs84_to_sphere(lat1, lat2, lon1, lon2, alt1, alt2)
self.assertAlmostEqual(radius, 29265.6035812215, 5)
self.assertAlmostEqual(theta, 0.694979846308314, 5)
self.assertAlmostEqual(phi, -62.604956, 5)