[Qgis-developer] Memory data provider persistence

Chris Crook ccrook at linz.govt.nz
Thu Jul 26 13:52:47 PDT 2012


Hi Even

Sorry .. lost wasn't quite correct.  The point is that my code for saving some users data and then reloading needs to take account of whether they have a field called fid or not if I want the list of fields unchanged after saving and reloading the data.

Either I have to record somewhere that the fid field is real (ie was in the original data set), and set the GML_EXPOSE_FID accordingly so that it appears in the reloaded data, or alternatively rename the users fields an a reversible way before I save the data so that none of the saved fields can be called fid (eg prefix all fields with "u_" for example), and set GML_EXPOSE_FID to NO.

At least that is my understanding of the way the driver works now?

Cheers
Chris 

-----Original Message-----
From: Even Rouault [mailto:even.rouault at mines-paris.org] 
Sent: Friday, 27 July 2012 7:59 a.m.
To: Chris Crook
Cc: qgis-developer at lists.osgeo.org; haubourg
Subject: Re: [Qgis-developer] Memory data provider persistence

Le jeudi 26 juillet 2012 21:41:57, Chris Crook a écrit :
> Hi Even
> 
> Thanks for the suggestion and code examples - very helpful. I haven't 
> followed up on this yet partly because this has prompted me to look at 
> other storage formats for the data (something I'd been putting off).
> 
> If I understand the GML driver documentation properly then I would 
> have to manage the possibility of the user having a field called FID, 
> as after I've saved the data, then reloaded with GMS_EXPOSE_FID set to 
> NO, that field will be lost?

If a user creates a 'fid' field, then that one will be used to set the fid attribute of the element. It will not be "lost" strictly speaking, but indeed if GML_EXPOSE_FID is set to NO, then it will not be visible.

> As you suggest, renaming the fields before saving and then after 
> reloading would fix handle this.

Not sure to understand you here : are you speaking about the mechanism for saving the old value of GML_EXPOSE_FID, setting GML_EXPOSE_FID=OLD, calling
OGROpen() and restoring the original value of GML_EXPOSE_FID ? If so, this will not change anything about the behaviour with a user field called 'fid'.

The intention here was not to interfere with other parts of QGIS that might manipulate GML files. For example, if a user opens a GML file through "Add Vector Layer", he might want to see the fid reported.

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