'Testing OGR Geometries with Spatial Reference objects.'

def test09a_srs(self):

    for mp in self.geometries.multipolygons:
        sr = SpatialReference('WGS84')
        mpoly = OGRGeometry(mp.wkt, sr)
        self.assertEqual(sr.wkt, mpoly.srs.wkt)
        klone = mpoly.clone()
        self.assertEqual(sr.wkt, klone.srs.wkt)
        for poly in mpoly:
            self.assertEqual(sr.wkt, poly.srs.wkt)
            for ring in poly:
                self.assertEqual(sr.wkt, ring.srs.wkt)
        a = OGRGeometry(self.geometries.topology_geoms[0].wkt_a, sr)
        b = OGRGeometry(self.geometries.topology_geoms[0].wkt_b, sr)
        diff = a.difference(b)
        union = a.union(b)
        self.assertEqual(sr.wkt, diff.srs.wkt)
        self.assertEqual(sr.srid, union.srs.srid)
        mpoly = OGRGeometry(mp.wkt, 4326)
        self.assertEqual(4326, mpoly.srid)
        mpoly.srs = SpatialReference(4269)
        self.assertEqual(4269, mpoly.srid)
        self.assertEqual('NAD83', mpoly.srs.name)
        for poly in mpoly:
            self.assertEqual(mpoly.srs.wkt, poly.srs.wkt)
            poly.srs = 32140
            for ring in poly:
                self.assertEqual(32140, ring.srs.srid)
                self.assertEqual('NAD83    /    Texas    South    Central', ring.srs.name)
                ring.srs = str(SpatialReference(4326))
                self.assertEqual(4326, ring.srs.srid)
                ring.srid = 4322
                self.assertEqual('WGS    72', ring.srs.name)
                self.assertEqual(4322, ring.srid)
