Changeset 7101
- Timestamp:
- 02/08/08 11:36:43 (7 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/gis/django/contrib/gis/geos/base.py
r6978 r7101 407 407 ptr = from_wkb(wkb, len(wkb)) 408 408 if ptr: 409 # Reassigning pointer, and resetting the SRID.409 # Reassigning pointer, and getting the new coordinate sequence pointer. 410 410 destroy_geom(self.ptr) 411 411 self._ptr = ptr 412 self.srid = g.srid 413 else: 414 pass 412 self._set_cs() 413 414 # Some coordinate transformations do not have an SRID associated 415 # with them; only set if one exists. 416 if g.srid: self.srid = g.srid 415 417 416 418 #### Topology Routines #### django/branches/gis/django/contrib/gis/tests/test_geos.py
r6978 r7101 6 6 7 7 if HAS_NUMPY: from numpy import array 8 if HAS_GDAL: from django.contrib.gis.gdal import OGRGeometry, SpatialReference 8 if HAS_GDAL: from django.contrib.gis.gdal import OGRGeometry, SpatialReference, CoordTransform 9 9 10 10 class GEOSTest(unittest.TestCase): … … 674 674 self.assertNotEqual(poly._ptr, cpy2._ptr) 675 675 676 def test23_transform(self): 677 "Testing `transform` method." 678 if not HAS_GDAL: return 679 orig = GEOSGeometry('POINT (-104.609 38.255)', 4326) 680 trans = GEOSGeometry('POINT (992385.4472045 481455.4944650)', 2774) 681 682 # Using a srid, a SpatialReference object, and a CoordTransform object 683 # for transformations. 684 t1, t2, t3 = orig.clone(), orig.clone(), orig.clone() 685 t1.transform(trans.srid) 686 t2.transform(SpatialReference('EPSG:2774')) 687 ct = CoordTransform(SpatialReference('WGS84'), SpatialReference(2774)) 688 t3.transform(ct) 689 690 for p in (t1, t2, t3): 691 prec = 3 692 self.assertAlmostEqual(trans.x, p.x, prec) 693 self.assertAlmostEqual(trans.y, p.y, prec) 694 676 695 def suite(): 677 696 s = unittest.TestSuite()
