Opened 19 years ago

Last modified 19 years ago

#685 closed defect (fixed)

ogr.Geometry.TransformTo() causes segfault

Reported by: schuyler@… Owned by: warmerdam
Priority: high Milestone:
Component: OGR_SF Version: unspecified
Severity: minor Keywords:
Cc:

Description

The following ogr.py code causes a SIGSEGV on my system:

# mpts and pt are ogr.Layer objects (in PostGIS)
to_srs = roadseg.GetSpatialRef()
pt = mpts.GetNextFeature()
pt.GetGeometryRef().TransformTo(to_srs)

I am running GDAL 1.2.5 on Linux. Note that pt.GetGeometryRef.Transform(oct)
does not fail, where oct is a properly initialized osr.CoordinateTransform, so
this is a non-urgent bug. The gdb back trace on my system is as follows:

#0  0x00000000 in ?? ()
#1  0x005ced36 in OGRPoint::transform () from /usr/lib/libgdal.so.1
#2  0x005d3128 in OGR_G_Transform () from /usr/lib/libgdal.so.1
#3  0x00f66a42 in _wrap_OGR_G_Transform ()
   from /usr/lib/python2.3/site-packages/_gdalmodule.so
#4  0x080ea40d in PyCFunction_Call ()
#5  0x080ab28d in PyEval_GetFuncDesc ()
#6  0x080a8f79 in PyEval_EvalCode ()
#7  0x080ab3e0 in PyEval_GetFuncDesc ()
#8  0x080ab19a in PyEval_GetFuncDesc ()
#9  0x080a8f79 in PyEval_EvalCode ()
#10 0x080ab3e0 in PyEval_GetFuncDesc ()
#11 0x080ab19a in PyEval_GetFuncDesc ()
#12 0x080a8f79 in PyEval_EvalCode ()
#13 0x080a9b5e in PyEval_EvalCodeEx ()
#14 0x080a6b57 in PyEval_EvalCode ()
#15 0x080c9909 in PyRun_FileExFlags ()
#16 0x080c8834 in PyRun_SimpleFileExFlags ()
#17 0x080c811a in PyRun_AnyFileExFlags ()
#18 0x080552d7 in Py_Main ()
#19 0x08054cf9 in main ()

Change History (1)

comment:1 by warmerdam, 19 years ago

Schuyler, 

In ogr.py please change the TransformTo() method to look like this:

    def TransformTo( self, srs_out ):
        return _gdal.OGR_G_TransformTo( self._o, srs_out._o )

It was calling Transform() instead.  I have committed this change in CVS, and
it should fix things up through I haven't tested it here. 


    

Note: See TracTickets for help on using tickets.