OGR_FD_GetGeomFieldDefn with SpatialViews, returns more than one Geometry
|Reported by:||mj10777||Owned by:||warmerdam|
|Severity:||major||Keywords:||Sqlite, Spatialite, SpatialView|
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);
- will return the name of the first MULTIPOLYGON
- will return the type MULTILINESTRING (not MULTIPOLYGON)
- will return the name of the MULTILINESTRING
- will return the type MULTILINESTRING
- 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