Testing transform().
(self)
| 347 | mpoly.srid = mpoly.srid |
| 348 | |
| 349 | def test_srs_transform(self): |
| 350 | "Testing transform()." |
| 351 | orig = OGRGeometry("POINT (-104.609 38.255)", 4326) |
| 352 | trans = OGRGeometry("POINT (992385.4472045 481455.4944650)", 2774) |
| 353 | |
| 354 | # Using an srid, a SpatialReference object, and a CoordTransform object |
| 355 | # or transformations. |
| 356 | t1, t2, t3 = orig.clone(), orig.clone(), orig.clone() |
| 357 | t1.transform(trans.srid) |
| 358 | t2.transform(SpatialReference("EPSG:2774")) |
| 359 | ct = CoordTransform(SpatialReference("WGS84"), SpatialReference(2774)) |
| 360 | t3.transform(ct) |
| 361 | |
| 362 | # Testing use of the `clone` keyword. |
| 363 | k1 = orig.clone() |
| 364 | k2 = k1.transform(trans.srid, clone=True) |
| 365 | self.assertEqual(k1, orig) |
| 366 | self.assertNotEqual(k1, k2) |
| 367 | |
| 368 | # Different PROJ versions use different transformations, all are |
| 369 | # correct as having a 1 meter accuracy. |
| 370 | prec = -1 |
| 371 | for p in (t1, t2, t3, k2): |
| 372 | self.assertAlmostEqual(trans.x, p.x, prec) |
| 373 | self.assertAlmostEqual(trans.y, p.y, prec) |
| 374 | |
| 375 | def test_transform_dim(self): |
| 376 | "Testing coordinate dimension is the same on transformed geometries." |
nothing calls this directly
no test coverage detected