Open robintw opened 4 years ago
The reason is that the two methods of adding layers are using two different providers: spatialite
and ogr
, spatialite provider does not handle mixed geometry tables correctly while ogr
(GDAL) does.
Ah ok.
Is there a way to point this out in the UI if a mixed geometry table is found? At the moment it seems to recognise the table correctly as it says 'GEOMETRY' in the Type column. Could this be changed to something like GEOMETRY (Unsupported)
or something?
Yeah, I didn't dig into the code but there maybe a better solution by exposing multiple rows (one for each geometry type) in the spatialite source select dialog. This would slow down the dialog though, because we would need to scan the whole table to find out the actual geometry types.
Generally speaking, GEOMETRY type should be avoided like plague, QGIS internally supports only one geometry type for each layer anyway.
Sorry to bump a very old issue, but I ran into this last night and I wasn't sure how/where would be best to ask about this:
Generally speaking, GEOMETRY type should be avoided like plague
Would you be kind enough to give some detail on this? Are you specifically referring to avoiding the GEOMETRY
type in QGIS? Or SpatiaLite? Both? I was thinking about using it to be able to accept all kinds of geometry not just MULTIPOLYGON.
Is using GEOMETRY
inefficient somehow compared to just picking one?
I tried finding information on this on Spatialite's documentation but haven't been able to find anything on the subject so far.
@robintw Hello, is this issue still valid on recent releases?
Yes @Pedro-Murteira, this still occurs on 3.24.2.
Describe the bug I have a Spatialite database with a table containing a generic GEOMETRY column (ie. not POINT or POLYGON, but generic GEOMETRY). When adding this database to QGIS through the Layer->Add Layer->Add Spatialite Layer, it gets added as a non-spatial table. However, when I add it through Layer->Add Layer->Add Vector Layer, I get a dialog showing the 'sub-layers' (one for points and one for lines), and it allows me to add both of those as spatial layers.
How to Reproduce
geometries
is listed with theGEOMETRY
type.To create the database from scratch, create a new SQLite database (eg via the command-line
sqlite3
tool), load the Spatialite extension (eg.load mod_spatialite.dll
) and run the following SQL:QGIS and OS versions