[Qgis-developer] memory-based layers and projects
Martin Landa
landa.martin at gmail.com
Mon Oct 10 09:59:27 PDT 2016
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
"""
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
More information about the Qgis-developer
mailing list