[gdal-dev] Unable to use geom.ExportToWkt() in Python ?
Gregor at HostGIS
gregor at hostgis.com
Tue Nov 23 17:43:35 EST 2010
Hey all. I am using the OGR binding for python, to open a SHP and print
a geometry's WKT. This works until I try to call geom.ExportToWkt() At
that time I simply get "Premature end of script headers" Running it from
the command line I get a segmentation fault.
The code snippet:
driver = ogr.GetDriverByName('ESRI Shapefile')
datasource = driver.Open(shapefile,0)
layer = datasource.GetLayer()
spatialRef = layer.GetSpatialRef()
firstgeom = layer.GetFeature(0).GetGeometryRef()
wkt = firstgeom.ExportToWkt()
Versions:
GDAL 1.7.1
Python 2.5.1
The strace output is not particularly helpful to me. Maybe it's helpful
to someone else?
open("/maps/images.tmp/zipUdUf9L.zip/fedlanl020.dbf", O_RDONLY) = 4
open("/maps/images.tmp/zipUdUf9L.zip/fedlanl020.cpg", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/maps/images.tmp/zipUdUf9L.zip/fedlanl020.CPG", O_RDONLY) = -1
ENOENT (No such file or directory)
fstat(4, {st_mode=S_IFREG|0644, st_size=55294, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x2b8f79cf5000
read(4, "\3i\t\17a\1\0\0\341\0\234\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
4096) = 4096
open("/maps/images.tmp/zipUdUf9L.zip/fedlanl020.prj", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/maps/images.tmp/zipUdUf9L.zip/fedlanl020.PRJ", O_RDONLY) = -1
ENOENT (No such file or directory)
stat("/maps/images.tmp/zipUdUf9L.zip/fedlanl020.idm", 0x7fffd87a7c10) =
-1 ENOENT (No such file or directory)
stat("/usr/lib64/python2.5/site-packages/GDAL-1.7.1-py2.5-linux-x86_64.egg/osgeo/types",
0x7fffd87a5da0) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.5/site-packages/GDAL-1.7.1-py2.5-linux-x86_64.egg/osgeo/types.so",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.5/site-packages/GDAL-1.7.1-py2.5-linux-x86_64.egg/osgeo/typesmodule.so",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.5/site-packages/GDAL-1.7.1-py2.5-linux-x86_64.egg/osgeo/types.py",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.5/site-packages/GDAL-1.7.1-py2.5-linux-x86_64.egg/osgeo/types.pyc",
O_RDONLY) = -1 ENOENT (No such file or directory)
futex(0x40eceb0, FUTEX_WAKE, 1) = 0
read(3, "5\364c\300\0\0\0\340v\321P@\0\0\0\0X\364c\300\0\0\0`D\321"...,
4096) = 4096
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
I do wonder about those "no such file or directory" at the end, where
it's trying to open something called "types" and trying everything it
can. True, there are no files named "types" Is that relevant?
--
HostGIS, Open Source solutions for the global GIS community
Greg Allensworth - SysAdmin, Programmer, GIS Person, Security
Network+ Server+ A+ Security+ Linux+
PHP PostgreSQL MySQL DHTML/JavaScript/AJAX
"No one cares if you can back up — only if you can recover."
More information about the gdal-dev
mailing list