Re: [gdal-dev] python bindings: strange behavior with layer

2010-07-22 Thread Python Gis
Thanks Luke this is exactly the approach I have used, solving the issue To me looks strange that a layer can't exist without the datasource in the scope, with other GIS API is not so. But anyway, good to know best regards - Original Message From: "Pinner, Luke" To:

Re: [gdal-dev] python bindings: strange behavior with layer

2010-07-21 Thread Python Gis
> 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

[gdal-dev] python bindings: strange behavior with layer

2010-07-20 Thread Python Gis
Hi this is my code: from osgeo import ogr def OpenLayer(shape_path, shape_name): drv_shp = ogr.GetDriverByName('ESRI Shapefile') shp_ds = drv_shp.Open(shape_path, 1) layer = shp_ds.GetLayerByName(shape_name) print 'Name from method: %s' % layer.GetName() return layer; layer =