[Qgis-developer] Memory data provider persistence

Chris Crook ccrook at linz.govt.nz
Mon Dec 6 13:05:53 EST 2010


Hi All

Fair comment I guess.  In fact Barry's suggestion is pretty much back at my original ticket on this issue.  This had two components, one was the warning about memory provider layers, and the other was making it easier to save them (or more accurately, to replace the memory layer with the saved layer in the project).  Ideally the legend would also have some sort of visual clue as to which layers were not yet saved.

Nonetheless I do think there is value in having the memory provided data saved more or less transparently to the user.  For example the contour plugin builds its contours in a memory layer.  I don't want them to disappear when I save and reopen the project.  Yet sometimes  I want to save the project quickly without having to decide where and in what format I want bits of it saved.  For example when I have to exit the train on the way to work!!  I just want to be able to save the project and then start up later and carry on working.

While the memory provider is intended for transient data, I think that it is a valid user requirement that it persist beyond the user session.

In terms of the QDataStream suggestion, the idea is not to create a format, it is to persist the memory layer efficiently and transparently.  I don't think that is the same thing.  

I guess that the requirements for the format are that it is reasonably compact and can be efficiently read from and written to a sequential data stream (to facilitate possible writing to a zip file or other compressed format in the future).  Also it would be nice if it didn't generate a plethora of files.  Any other format that meets that requirement would be good, and I certainly agree that using an open format is preferable.  Other suggestions??

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

On Mon, Dec 6, 2010 at 10:45 AM, Barry Rowlingson
<b.rowlingson at lancaster.ac.uk> wrote:
> On Mon, Dec 6, 2010 at 2:04 AM, Chris Crook <ccrook at linz.govt.nz> wrote:
>
>> So, for my requirement for memory provider persistance, the only real question is what is the right way to do it.  Although Martin had suggested a spatialite database, my leaning is towards a simple QDataStream.  A simple implementation could be (in crude pseudo code)
>>
>> Qstring header("Qgis data file");
>> Int version = 1;
>> stream << header << version;
>>
>> Foreach memory_provider
>>  if provider < persist
>>      stream << layer_id
>>      stream << attribute_count
>>      foreach attribute
>>         stream << attribute_definition
>>      stream << feature_count
>>      foreach feature
>>         stream << feature
>>
>> This could readily be reloaded after the XML project file is read.
>>
>> Because it is processed sequentially it would sit comfortably in a ZIP file and be sequentially read from it without needing to be extracted and then processed (as a spatialite database would need to be).  It is portable between OS etc.
>>
>> If the user actually wants a spatialite database, or any other format, then they can save the layer to that.
>>
>> How does this sound to people?
>
>  It sounds like you're just creating another spatial data format. Why
> not, on project exit, just go "You have unsaved memory data layers -
> would you like them converted to [gml|shapefile|spatialite|whatever]
> and reloaded before saving/qutting or do you want to lose them
> forever?".

I completely agree with Barry - to me it looks like a waste of time to
invent a new data format - exclusively readable just by QGIS - and
intended just to load/store some data from/to memory provider.
Additionally, memory provider was thought to represent just temporary
(nonpersistent) data - so asking the user to convert it to some other
format when exiting seems reasonable to me.

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