> > What do you mean by "opening the source" and "retrieving the layer" ? > They sound like the same operation to me ?
In the Python code you are using the OGR Interface ds = ogr.Open(ogruri) in c++ (as used in QgsOgrProvider) this corresponds to: OGRDataSourceH hDS = OGROpen( pszPath, bUpdate, &hDriver ); it will only open the Datasource for use. OGR will read the datasource and create the infastructure needed during reading - such as a list of layers -- in gdal 1.* each geometry is 1 layer (with only 1 geometry-field) -- in gdal 2.* each table is 1 layer that may contain more than 1 geometry-field At this point you can decide what to do - list the layers and the fields - select a specific layer with a geometry-field Either with the layer-id: python: ly = ds.GetLayer(layerid) in c++ (as used in QgsOgrProvider) this corresponds to: ogrLayer = OGR_DS_GetLayer( ogrDataSource, iLayerIndex ); or with the layer-name ogrLayer = OGR_DS_GetLayerByName( ogrDataSource, TO8( sLayerName ) ); when all tasks are completed, the Datasource is closed. Inside QgsOgrProvider all of this is done as needed, but when using the OGR-API directly each step must be done manually. Mark Johnson
_______________________________________________ Qgis-developer mailing list [email protected] List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
