def test_common_projection(self): if not HAS_PROJ: self.skipTest('No projection library available') p_lonlat = (5.386362, 43.293414,) t = ProjTransformer('EPSG:3857') # "Google" Mercator p_ref = (599607.075, 5356739.624,) p = t.from_lonlat(*p_lonlat) self.assertAlmostEqual(p[0], p_ref[0], places=3) self.assertAlmostEqual(p[1], p_ref[1], places=3) p = t.to_lonlat(*p_ref) self.assertAlmostEqual(p[0], p_lonlat[0], places=3) self.assertAlmostEqual(p[1], p_lonlat[1], places=3) t = ProjTransformer('EPSG:2154') # Lambert 93 p_ref = (893744.752, 6246732.852,) p = t.from_lonlat(*p_lonlat) self.assertAlmostEqual(p[0], p_ref[0], places=3) self.assertAlmostEqual(p[1], p_ref[1], places=3) p = t.to_lonlat(*p_ref) self.assertAlmostEqual(p[0], p_lonlat[0], places=3) self.assertAlmostEqual(p[1], p_lonlat[1], places=3)
def test_no_projection_required(self): # There should not be any difference between lon/lat and EPSG:4326 t = ProjTransformer('EPSG:4326') self.assertEqual(t.to_lonlat(5.386362, 43.293414), (5.386362, 43.293414,)) self.assertEqual(t.from_lonlat(5.386362, 43.293414), (5.386362, 43.293414,))