[Qgis-developer] Memory data provider persistence

Chris Crook ccrook at linz.govt.nz
Sat Dec 4 12:36:30 EST 2010


Yes, I can see that there definitely are advantages to a ZIP format from the point of view of accessing the contents from other programs or a command line interface. 

I think either would be as easy from within QGIS - an Sqlite blob can be used pretty much as a file stream so any arbitrary content could be embedded in the Sqlite database.  I guess it depends whether you want to get at the spatial data more easily, by using the Sqlite option, or the other contents, by using the zip option.  I think that you are right, that the zip option is probably more useful for a project file.  And as you point out, it is an approach used by other software too.

If we are going the zip route, I wonder if it would be a better idea to serialize the memory data to a QDataStream represented as a file in the zip archive, rather than as a spatialite database.  The thought here is that it could then be read directly from the zip archive (as it would be read sequentially to reload), whereas an Sqlite database would probably need to be extracted to a temporary file to use.  And the saved layer would remain a memory provided layer that way too, rather than an Sqlite layer, so the reinstated project would be a more accurate copy of the one originally saved.

Cheers
Chris
________________________________________
From: Martin Dobias [wonder.sk at gmail.com]
Sent: 05 December 2010 06:07
To: Chris Crook
Cc: qgis-developer at lists.osgeo.org
Subject: Re: [Qgis-developer] Memory data provider persistence

Hi Chris

On Sat, Dec 4, 2010 at 3:35 AM, Chris Crook <ccrook at linz.govt.nz> wrote:
> Another way to achieve a similar result could be to embed the project file in the spatialite database?  That would make the memory provider data easier to use - basically it just becomes a spatialite provided layer.  The project itself becomes harder to manually edit, if you wanted to do so.  However it could easily be exported to a separate file if that is required.  And the whole thing could still be zipped if you wanted to.

This would be also a solution, though I would prefer the former
approach with a ZIP file containing the project XML and other files.
The advantages I see here is that it would be simpler to store various
other types of data - with the project we could store also raster
layers, SVGs for symbols or any other blobs. Loading and saving these
data from/to sqlite database would be a bit cumbersome compared to an
archive.

Regards
Martin
______________________________________________________________________________________________________

This message contains information, which is confidential and may be subject to legal privilege. 
If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message.
If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info at linz.govt.nz) and destroy the original message.
LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ.

Thank you.
______________________________________________________________________________________________________


More information about the Qgis-developer mailing list