[Qgis-developer] Vector Layer Symbology Registry
JPalmer at linz.govt.nz
Sun Feb 14 22:14:18 EST 2010
I'm planning on creating a tool for the centralised storage and retrieval of QGIS vector layer styling. What I would like to do is whenever PostGIS/Shape file layers are loaded into any project, the associated QGIS styling information stored in a database is automatically set for that layer. This would be particularly useful for accessing consistent styling for data sources in multiple user environments.
My initial thought is to create a python plug-in that does two things:
1) Stores QML styling information and a layer identifier into a database for any selected vector layer. This database could be a PostgreSQL instance or the QGIS Sqlite DB.
2) On the load of a layer its identifier is matched in the database and will automatically have its styling set.
A small enhancement would be to apply a stored style to any given vector layer. I'm also planning on storing and retrieving styling information for v1 and v2 renderers.
At this point, I have three questions:
1) What is the best layer identifier to use for storage in the database? I currently have a set PostGIS layers are not unique across the whole database (i.e. some tables with same name in difference schemas), so this could be an issue when using the layer name. I thought about using the datasource URI, but that does not look very useful for PostGIS layers as the table schema is only populated when not in the PostgreSQL user's schema search path.
2) Is the best way to set the layer styling information on load by subscribing to the QgsMapLayerRegistry layerWasAdded signal? Does this event occur before the layer is first rendered?
3) I guess I'm going to have issues with the QML styling XML changing between QGIS versions. What is the best way to deal with this?
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Qgis-developer