Ticket #12312: 12312_ogrgeometry_transform_wkt_3d.diff

File 12312_ogrgeometry_transform_wkt_3d.diff, 1.4 KB (added by Charlie DeTar, 15 years ago)

Failing test case for OGRGeometry.transform changing WKT dimensions from 2D to 3D

  • django/contrib/gis/tests/geo3d/tests.py

     
    22from django.contrib.gis.db.models import Union, Extent3D
    33from django.contrib.gis.geos import GEOSGeometry, Point, Polygon
    44from django.contrib.gis.utils import LayerMapping, LayerMapError
     5from django.contrib.gis.gdal import OGRGeometry
    56
    67from models import City3D, Interstate2D, Interstate3D, \
    78    InterstateProj2D, InterstateProj3D, \
     
    228229            for city in City3D.objects.translate(0, 0, ztrans):
    229230                self.assertEqual(city_dict[city.name][2] + ztrans, city.translate.z)
    230231
     232    def test08_ogrgeometry_transform_wkt(self):
     233        "Testing dimensions on WKT output of geometries transformed with OGRGeometry.transform"
     234        wkt_2d = "MULTILINESTRING ((0 0,1 1,2 2))"
     235        wkt_3d = "MULTILINESTRING ((0 0 0,1 1 1,2 2 2))"
     236        srid = 4326
     237
     238        geom = OGRGeometry(wkt_2d, srid)
     239        geom.transform(srid)
     240        self.assertEqual(geom.dimension, 2)
     241        self.assertEqual(geom.wkt, wkt_2d)
     242
     243        geom = OGRGeometry(wkt_3d, srid)
     244        geom.transform(srid)
     245        self.assertEaual(geom.dimension, 3)
     246        self.assertEaual(geom.wkt, wkt_3d)
     247
     248
     249
    231250def suite():
    232251    s = unittest.TestSuite()
    233252    s.addTest(unittest.makeSuite(Geo3DTest))
Back to Top