def test_latlong_to_utm(self): """Tests latlong_to_utm() coordinates tested against: http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html""" coords = utm.latlong_to_utm(13.73, 51.03, 33) # , zone, [0, 0]) self.assertEqual(round_utm_coord(coords[0]), 410943.61) self.assertEqual(round_utm_coord(coords[1]), 5653928.43)
def test_utm_latlong(self): """Test utm to latlong and latlong to utm by trying 100 coordinates in both functions. What about southern hemisphere?!??""" for lat in xrange(10): for lon in xrange(10): zone = utm.long_to_zone(lon) coords = utm.latlong_to_utm(lat, lon, zone) coords = utm.utm_to_latlong(coords[0], coords[1], zone, False) self.assertEqual(round_utm_coord(coords[0]), lat) self.assertEqual(round_utm_coord(coords[1]), lon)
def test_deg_to_rad(self): """Tests deg_to_rad()""" self.assertEqual(round_utm_coord(utm.deg_to_rad(57.3)), 1) self.assertEqual(round_utm_coord(utm.deg_to_rad(114.59)), 2) self.assertEqual(round_utm_coord(utm.deg_to_rad(171.89)), 3)