[Qgis-developer] Memory data provider persistence

Martin Dobias wonder.sk at gmail.com
Thu Dec 2 17:01:38 EST 2010


Hi Chris

On Mon, Nov 29, 2010 at 8:54 PM, Chris Crook <ccrook at linz.govt.nz> wrote:
> Hi All
>
> I'm looking for ideas/suggestions/comments on the memory data provider.
>
> A while ago I raised a ticket http://trac.osgeo.org/qgis/ticket/2487, the essence of which is that if you save and reload a project nothing should have changed, but if you have a layer supported by a memory data provider then its contents get lost.
>
> In the ticket I suggested that the user should be warned on saving, and the layers not included in the project file.  That way at least you don't end up with empty layers.
>
> I'm now coming to a different point of view, which is that it would make much more sense to save the data for the memory provider into the project file.

Having a possibility to save the data into a project would be a nice
feature. However I think that saving the features directly into the
XML project file wouldn't scale well with the amount of data. It can
work well for small datasets, though I'm afraid that it will fail with
a lot of data. One reason is that the project file would get pretty
big due the verbosity of XML, another problem would be with the memory
footprint and parsing speed - we're using DOM.

I have started to think about a more radical step: to allow the
projects to be not only XML files, but additionally they could be e.g.
ZIP files with project XML file inside and optionally some more files.
AFAIK OpenDocument format (used in OpenOffice) does this too.
Internally QGIS could ask the user and convert his data from memory
provider (or any other provider) to e.g. spatialite database that
would be included in that project ZIP file.

This would involve the following changes:
- implement reading and writing of compressed project files (using zlib)
- write a generic QgsVectorLayer -> SpatiaLite export class (similar
to QgsVectorFileWriter or an extension of it)
- add support to read/write "embedded" layers

This would also enable a nice feature to let QGIS pack all data into
one (compressed) file and pass just that file around!

What do you (and others) think of such solution?

Regards
Martin


More information about the Qgis-developer mailing list