Bug report #10584
Saving as SpatiaLite fails with "save as" dialog when input is a multi geometry
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||18990|
When trying to save a multipolygon shapefile to Spatialite using the "save as" dialog the operation fails. Actually the fail is by ogr2ogr. When using ogr2ogr from the command line it is enough to add
option, but in the "save as" dialog is not clear if such option can be added in the "custom options" of the same dialog.
The real issue seems that QGIS is not consistent, in fact importing into a Spatialite DB works fine for multigeometry input layers both using the Drag and Drop from the QGIS browser and using the import function of DB manager.
It also works ok using the "convert format" tool (based on ogr2ogr) of the processing toolbox (without needed to add manually any parameter).
It is not clear to me how that step made into the documentation as the very same issue affects QGIS down to 1.8 included (maybe in an earlier release it was ok).
On page 7 of the QGIS Training Manual, users are instructed to save the landuse layer as SpatialLite. In so doing, the following error was encountered, using the dataset as described in the training manual.
Export to vector file failed.
Error: Feature write errors:
Feature creation error (OGR error: sqlite3_step() failed:
landuse.GEOMETRY violates Geometry constraint [geom-type or SRID not allowed] (19))
Only 52 of 53 features written.
A file is created in the directory, but nothing is added to the map
#1 Updated by Giovanni Manghi almost 6 years ago
- Status changed from Open to Feedback
#7 Updated by Teliph Andersson over 5 years ago
- Status changed from Closed to Reopened
Saving a shapefile as spatialite fails for me using:
QGIS version 2.4.0-Chugiak QGIS code revision exported
Compiled against Qt 4.8.6 Running against Qt 4.8.6
Compiled against GDAL/OGR 1.10.1 Running against GDAL/OGR 1.10.1
Compiled against GEOS 3.4.2-CAPI-1.8.2 Running against GEOS 3.4.2-CAPI-1.8.2 r3921
PostgreSQL Client Version 9.4beta2 SpatiaLite Version 4.1.1
QWT Version 6.0.0-svn PROJ.4 Version 480
Error: Feature creation error (OGR error: sqlite3_step() failed: spatialtest.GEOMETRY violates Geometry constraint [geom-type or SRID not allowed] (19))
Steps to reproduce:
- Add vector layer
- Save as... Spatialite
#8 Updated by Johannes Kroeger over 5 years ago
Reproduced here with:
QGIS version 2.4.0-Chugiak
QGIS code revision fe0a303
Compiled against Qt 4.8.6
Running against Qt 4.8.6
Compiled against GDAL/OGR 1.11.0
Running against GDAL/OGR 1.11.1
Compiled against GEOS 3.4.2-CAPI-1.8.2
Running against GEOS 3.4.2-CAPI-1.8.2 r3921
PostgreSQL Client Version 9.3.5
SpatiaLite Version 4.2.0
QWT Version 6.1.0
PROJ.4 Version 480
QScintilla2 Version 2.8.
#9 Updated by Giovanni Manghi over 5 years ago
- Subject changed from Saving SpatiaLite fails to Saving SpatiaLite fails with "save as" dialog when input is a multi geometry
- Affected QGIS version changed from 2.2.0 to master
- Resolution deleted (
- OS version deleted (
- Operating System deleted (
- Category changed from Documentation and Help to Vectors
#11 Updated by Giovanni Manghi over 5 years ago
- Subject changed from Saving SpatiaLite fails with "save as" dialog when input is a multi geometry to Saving as SpatiaLite fails with "save as" dialog when input is a multi geometry
- Priority changed from Normal to Severe/Regression
It is more clear now where the problem may come from:
until qgis 1.7.4 saving as "sqlite" (not spatialite, because the option was not available) and adding the custom option
worked as expected. Then this option stopped to work (giving an error similar to the one decribed here or creating a non functional SL db).
This should be tagged as a regression, but given the fact that there are alternatives it will be probably downgraded.