Gregor at HostGIS wrote:
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()

Gregor,

Geometries do not have the ExportToWkt() method.  This is a method on
the ogr.SpatialReference class.

Perhaps try:
  wkt = spatialRef.ExportToWkt()

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [email protected]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to