[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[DebianGIS] gdal/pylab bug



Hi,

I'm facing a problem using python-gdal.

I've made a test case to reproduce the problem. If you load the pylab
module in a script using gdal, some of the gdal methods will start
producing erroneous answers. I first guessed it was a problem between
Numeric and numpy but after having uninstalled numpy the problem is
still present.

The problem seems to be Debian specific.

I've attached the test case (two same tests : one without pylab, one
with pylab loaded).

Any help is welcome. My application is currently completly broken due to
this problem.

Didrik
'''
Pylab - numpy - Numeric - gdal interaction problem

In order to run this testcase you need to install the following Python modules
: python-gdal, python-matplotlib, python-Numeric and python-numpy

Author : Didrik Pinte <dpinte@itae.be>
Date   : 30 may 2006
'''
import unittest
import ogr

class TestIntersection(unittest.TestCase):
    
    def test_polyintersection(self):
        '''
        Test that surface intersection between two polygons returns a polygon
        '''

        t1wkt = 'POLYGON ((-1.0 50.5, -0.5 51.2, 0.3 50.9, -1 50.5))'
        t2wkt = 'POLYGON((-0.7 50.3, 0.1 51.0, 0.6 50.1, -0.7 50.3))'

        t1 = ogr.CreateGeometryFromWkt(t1wkt)
        t2 = ogr.CreateGeometryFromWkt(t2wkt)

        int1  = t1.Intersection(t2)
        self.assertEqual(int1.GetGeometryType(), ogr.wkbPolygon)
     
    def test_polyintersection_pylab(self):
        '''
        Test that surface intersection between two polygons returns a polygon
        '''

        import pylab

        t1wkt = 'POLYGON ((-1.0 50.5, -0.5 51.2, 0.3 50.9, -1 50.5))'
        t2wkt = 'POLYGON((-0.7 50.3, 0.1 51.0, 0.6 50.1, -0.7 50.3))'

        t1 = ogr.CreateGeometryFromWkt(t1wkt)
        t2 = ogr.CreateGeometryFromWkt(t2wkt)

        int1  = t1.Intersection(t2)
        self.assertEqual(int1.GetGeometryType(), ogr.wkbPolygon)
        
        del pylab

if __name__ == '__main__':
    unittest.main()

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=


Reply to: