'Testing `transform` method.'

@unittest.skipUnless(gdal.HAS_GDAL, u'gdal    is    required    to    transform    geometries')
def test_transform(self):

    orig = GEOSGeometry(u'POINT    (-104.609    38.255)', 4326)
    trans = GEOSGeometry(u'POINT    (992385.4472045    481455.4944650)', 2774)
    (t1, t2, t3) = (orig.clone(), orig.clone(), orig.clone())
    t1.transform(trans.srid)
    t2.transform(gdal.SpatialReference(u'EPSG:2774'))
    ct = gdal.CoordTransform(gdal.SpatialReference(u'WGS84'), gdal.SpatialReference(2774))
    t3.transform(ct)
    k1 = orig.clone()
    k2 = k1.transform(trans.srid, clone=True)
    self.assertEqual(k1, orig)
    self.assertNotEqual(k1, k2)
    prec = 3
    for p in (t1, t2, t3, k2):
        self.assertAlmostEqual(trans.x, p.x, prec)
        self.assertAlmostEqual(trans.y, p.y, prec)
