def test_inverting(self): for _ in range(500): lon, lat = rand() epsg = stateplane.identify(lon, lat) e, n = stateplane.from_lonlat(lon, lat) x, y = stateplane.to_lonlat(e, n, epsg=epsg) self.assertAlmostEqual(lon, x) self.assertAlmostEqual(lat, y)
def test_tolonlat(self): x, y = stateplane.to_lonlat(817080.8169336573, 99364.28495057777, epsg='32129') self.assertAlmostEqual(x, -75.2) self.assertAlmostEqual(y, 40.2) y, x = stateplane.to_latlon(817080.8169336573, 99364.28495057777, epsg='32129') self.assertAlmostEqual(x, -75.2) self.assertAlmostEqual(y, 40.2)
def test_tolonlat_err(self): with self.assertRaises(ValueError): stateplane.to_latlon(817080.8169336573, 99364.28495057777) stateplane.to_lonlat(817080.8169336573, 99364.28495057777)