id summary reporter owner description type status priority milestone component version severity resolution keywords cc 6659 OGR_FD_GetGeomFieldDefn with SpatialViews, returns more than one Geometry mj10777 warmerdam "I am attempting to adapt the QgsOgrProvider to retrieve Geometry Layers correctly when using gdal 2.*. Based on the idea that for each Layer, one must loop through the Feature count. This works correctly for both gdal 1.* and 2.* SpatialTables with multiple Geometries. It also works correctly when a SpatialView has been properly defined * 1 geometry properly declared * only this geometry is contained in the view ---- However, should the view also contain other geometries * the geometries up to the declared geometry are also listed in the result * OGR_FD_GetGeomFieldCount(fdef) (both gdal 1.* and 2.*) Sample: view contains 4 geometries, the second is declared * 1) a MULTIPOLYGON * 2) a MULTILINESTRING <-- registered as view-geometry * 3) a MULTIPOLYGON * 4) a POINT {{{ field_count=OGR_FD_GetGeomFieldCount(fdef) // returns 2 // loop i_field OGRGeomFieldDefnH fdef_geom=OGR_FD_GetGeomFieldDefn(fdef,i_field); QString theLayerFieldName = FROM8(OGR_GFld_GetNameRef(fdef_geom)); OGRwkbGeometryType layerGeomType=OGR_GFld_GetType(fdef_geom); }}} i_field=0: * OGR_GFld_GetNameRef * will return the name of the first MULTIPOLYGON * OGR_GFld_GetType * will return the type MULTILINESTRING (not MULTIPOLYGON) i_field=1: * OGR_GFld_GetNameRef * will return the name of the MULTILINESTRING * OGR_GFld_GetType * will return the type MULTILINESTRING GDALDatasetGetLayerByName * does not return a usable result for both ---- For a SpatialView * only 1 geometry should be returned * being the one found during OGRSQLiteDataSource::Open * the others should be ignored " defect closed high OGR_SF 2.0.0 major fixed Sqlite, Spatialite, SpatialView