[Qgis-developer] Vector Layer Symbology Registry

Jeremy Palmer JPalmer at linz.govt.nz
Tue Feb 16 18:22:39 EST 2010

> A good news is that you don't have to deal with the QML contents by
> yourself - QgsMapLayer::loadNamedStyle() triggers all the hard work
> for you.

Great. I'm gathering that using the loadNamedStyle method is only applicable if I decide to sync the style information into the qgis.qmldb database.

> I believe the layer should be identified by a triple (schema, table,
> geometry_column) - as used by PostGIS in geometry_columns table.

Yes I agree, but what is the best way to determine the schema, table and geometry_column for a layer that is loaded in QGIS? The provider URI does not seem sufficient to me, given my previous comments about the schema search path.

> Using that signal might work, though I'm not 100% sure.
> I have another suggestion: during creation, every map layer first
> tries to load it's default QML style (calling
> QgsMapLayer::loadDefaultStyle). For layers in files it tries to use
> the same file base name with .qml extension, if that fails, it tries
> to load the style from sqlite database ~/.qgis/qgis.qmldb. So, what
> you could do is to synchronize the local qgis.qmldb file from the
> PostGIS database (e.g. on every load, once a day or only when it's
> requested).

The only problem I see with this approach is I'm only storing the schema, table, and geometry_column fields for PostGIS layers in the centralised style database. Looking at the qgis.qmldb tbl_styles table it stores the qml data by provider URI, which in the case of the PostgreSQL provider includes other such data such as the host, post, SSL etc. If I were to populate the local tbl_styles table I would need that information, and even then it would only be specific to that PostgreSQL host.

> Btw. I've just committed a small fix for python wrappers in r12949 to
> make calling the styling functions better.


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