[gdal-dev] python bindings: strange behavior with layer
Python Gis
pygis2010 at yahoo.com
Wed Jul 21 03:18:36 EDT 2010
> drv_shp and shp_ds are going out of scope. Use
> ogr.Open, which will take care of all of this for you.
>
Thanks Howard
I am using now ogr.Open but there is still the same problem. Looks like I need to reopen the layer in each method, as far as it seems it cannot exist the layer without its datasource in the same context.
Or am I wrong?
this is my new code:
def getLayer2(shape_fullname):
ds = ogr.Open(shape_fullname, 0)
layer = ds.GetLayer(0)
print 'Name from method: %s' % layer.GetName()
return layer;
layer = getLayer2('output/myshape.shp')
print 'Name from main: %s' % layer.GetName()
still a segmentation fault in the second print statment
best regards
More information about the gdal-dev
mailing list