[Qgis-developer] memory-based layers and projects
Chris Crook
ccrook at linz.govt.nz
Mon Oct 10 10:04:19 PDT 2016
Hi Martin
One option you could use is to install the MemoryLayerSaver plugin. That saves the data for all memory layers in a project into a file named after the project file.
Cheers
Chris
________________________________________
From: Qgis-developer [qgis-developer-bounces at lists.osgeo.org] On Behalf Of Martin Landa [landa.martin at gmail.com]
Sent: 11 October 2016 05:59
To: qgis-dev
Subject: [Qgis-developer] memory-based layers and projects
Hi,
I have plugin which creates memory based layer and loads data into
this layer using its own reader.
"""
class MyLayer(QgsVectorLayer):
def __init__(self, name):
super(MyLayer, self).__init__('Point?crs=epsg:4326',
name,
'memory')
def load(self, reader):
for f in reader:
self._process_row(f) # add features to the map layer
"""
r
The problem occures when user stores such layer in the project. Then
the project file contains only:
"""
<datasource>memory?geometry=Point&crs=EPSG:4326&field=ader_microSvh:(0,0)...</datasource>
"""
So after loading the project, empty layer appears (with defined
attributes), but with no points loaded. Is there any way how to define
for such layer python code which would perform loading points using
plugin reader when opening a project?
Of course plugin could store (export) loaded data eg. into SQLite DB,
but this is not the way I would like to go.
Thanks in advance for any pointers, Martin
--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
_______________________________________________
Qgis-developer mailing list
Qgis-developer at lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
This message contains information, which may be in confidence 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