Bug report #4614

Bad SQLite export

Added by Patrice Vetsel - over 8 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:-
Affected QGIS version: Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data: Copied to github as #:14517

Description

Using Qgis 1.7.2
  • add a vector layer (shapefile)
  • select it, and right click to select "save as"
  • select "SQLite"
  • select your SCR
  • save it
    -> take some time ...
  • try to open your sqlite base with "add new spatialite layer"
  • select your new file
    -> error "seems to be a valid sqlite base but not a spatialite base"

History

#1 Updated by Giovanni Manghi over 8 years ago

  • Status changed from Open to Feedback

I don't think that the "sqlite" format in the "save as..." dialog means "spatialite". I would expect to get just a sqlite version of the table of attributes of the original vector.

If you want to convert easily a vector into a spatialite database, just create a new spatialite database (if don't have one already) then drag and drop the shapefile from the QGIS browser to the Spatialite database. To do that you will need qgis-master and the new DB Manager tool

http://www.youtube.com/faunalia#p/a/u/0/bBe7WctSAXI

#2 Updated by Alexander Bruy over 8 years ago

  • Status changed from Feedback to Closed
  • Resolution set to invalid

OGR supports both SQLite and SpatiaLite databases for storing geodata. Using "Save as" by default you save data as ordinal SQLite database (FDO). To get SpatiaLite database you should have GDAL>=1.7.0 explicitly linked against SpatiaLite and need to specify creation option SPATIALITE=yes.

#3 Updated by Patrice Vetsel - over 8 years ago

I expect to save a spatialite base. I select a projection so i'm waiting for a spatialite base. Like other formats proposed (geojson, shapefile, kml) they are georeferenced.
I confirm this problem on OsX and on Windows

#4 Updated by Jürgen Fischer over 8 years ago

Patrice Vetsel - wrote:

I expect to save a spatialite base. I select a projection so i'm waiting for a spatialite base. Like other formats proposed (geojson, shapefile, kml) they are georeferenced.
I confirm this problem on OsX and on Windows

Your expectation is wrong. "Save as..." saves as sqlite and not as spatialite unless you enter "SPATIALITE=yes" in the "Data source" field of the dialog (as mentioned in the context help). But if you save without that option, you can still add the exported file via "Add Vector layer...".

#5 Updated by Giovanni Manghi over 8 years ago

Jürgen Fischer wrote:

Patrice Vetsel - wrote:

I expect to save a spatialite base. I select a projection so i'm waiting for a spatialite base. Like other formats proposed (geojson, shapefile, kml) they are georeferenced.
I confirm this problem on OsX and on Windows

Your expectation is wrong. "Save as..." saves as sqlite and not as spatialite unless you enter "SPATIALITE=yes" in the "Data source" field of the dialog (as mentioned in the context help). But if you save without that option, you can still add the exported file via "Add Vector layer...".

Hi Jurgen and Alexander,

is this documented in the manual?

#6 Updated by Jürgen Fischer over 8 years ago

Giovanni Manghi wrote:

is this documented in the manual?

I just put it into the context help. I don't know if it's in the manual too.

#7 Updated by Alexander Bruy over 8 years ago

AFAIK this is not presented in manual. But all this info available in GDAL docs.

#8 Updated by Patrice Vetsel - over 8 years ago

Thank you all for your responses.

I open another report to ask for a new feature (save as spatialite)
#4615

Regards

Also available in: Atom PDF