mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
gis: lowered test transformation precision due to variations in updated PROJ and GDAL versions (i.e., tests run for GDAL 1.5 and PROJ 4.6.0).
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@6979 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
31111857cb
commit
387e6cca92
@ -155,21 +155,22 @@ class GeoModelTest(unittest.TestCase):
|
||||
# Pre-transformed points for Houston and Pueblo.
|
||||
htown = fromstr('POINT(1947516.83115183 6322297.06040572)', srid=3084)
|
||||
ptown = fromstr('POINT(992363.390841912 481455.395105533)', srid=2774)
|
||||
prec = 3 # Precision is low due to version variations in PROJ and GDAL.
|
||||
|
||||
# Asserting the result of the transform operation with the values in
|
||||
# the pre-transformed points. Oracle does not have the 3084 SRID.
|
||||
if not oracle:
|
||||
h = City.objects.transform('point', srid=htown.srid).get(name='Houston')
|
||||
self.assertEqual(3084, h.point.srid)
|
||||
self.assertAlmostEqual(htown.x, h.point.x, 8)
|
||||
self.assertAlmostEqual(htown.y, h.point.y, 8)
|
||||
self.assertAlmostEqual(htown.x, h.point.x, prec)
|
||||
self.assertAlmostEqual(htown.y, h.point.y, prec)
|
||||
|
||||
p1 = City.objects.transform('point', srid=ptown.srid).get(name='Pueblo')
|
||||
p2 = City.objects.transform(srid=ptown.srid).get(name='Pueblo')
|
||||
for p in [p1, p2]:
|
||||
self.assertEqual(2774, p.point.srid)
|
||||
self.assertAlmostEqual(ptown.x, p.point.x, 7)
|
||||
self.assertAlmostEqual(ptown.y, p.point.y, 7)
|
||||
self.assertAlmostEqual(ptown.x, p.point.x, prec)
|
||||
self.assertAlmostEqual(ptown.y, p.point.y, prec)
|
||||
|
||||
def test09_disjoint(self):
|
||||
"Testing the `disjoint` lookup type."
|
||||
|
@ -254,8 +254,8 @@ class OGRGeomTest(unittest.TestCase):
|
||||
|
||||
def test09b_srs_transform(self):
|
||||
"Testing transform()."
|
||||
orig = OGRGeometry('POINT (-104.609252 38.255001)', 4326)
|
||||
trans = OGRGeometry('POINT(992363.390841912 481455.395105533)', 2774)
|
||||
orig = OGRGeometry('POINT (-104.609 38.255)', 4326)
|
||||
trans = OGRGeometry('POINT (992385.4472045 481455.4944650)', 2774)
|
||||
|
||||
# Using an srid, a SpatialReference object, and a CoordTransform object
|
||||
# or transformations.
|
||||
@ -266,8 +266,9 @@ class OGRGeomTest(unittest.TestCase):
|
||||
t3.transform(ct)
|
||||
|
||||
for p in (t1, t2, t3):
|
||||
self.assertAlmostEqual(trans.x, p.x, 7)
|
||||
self.assertAlmostEqual(trans.y, p.y, 7)
|
||||
prec = 3
|
||||
self.assertAlmostEqual(trans.x, p.x, prec)
|
||||
self.assertAlmostEqual(trans.y, p.y, prec)
|
||||
|
||||
def test10_difference(self):
|
||||
"Testing difference()."
|
||||
|
Loading…
x
Reference in New Issue
Block a user