[Qgis-developer] How to load a QLR file with pyQGIS ?

Geo DrinX geodrinx at gmail.com
Wed Apr 15 23:50:56 PDT 2015


Very strange   :(

I inserted also the    triggerRepaint()   but nothing changes.

This is my sourcecode:

https://github.com/geodrinx/smartroadsense/blob/master/smartroadsense.py


If I drag and drop in  QGIS  my  "srs_data.qlr"   file, it works.

Instead, from python code, the style is not applied.

Could be because my data file is a CSV ?


2015-04-15 18:39 GMT+02:00 Gary Sherman <gsherman at geoapt.com>:

> On 4/15/15 2:24 AM, Geo DrinX wrote:
>
>> Hello,
>>
>>
>> there is a way to load a QLR file with  pyQGIS ?
>>
>> I tried using      vlayer.loadNamedStyle(qlrFileName)    but it seems
>> not to work.
>>
>>
>> What is the correct way ?
>>
>>  That is the correct way. Have you done the following after applying the
> style?:
>
> vlayer.triggerRepaint()
>
> You can test the result of applying the style using:
>
> result = vlayer.loadNamedStyle(qlrFileName)
>
> If result if False, the style was not loaded/applied.
>
> -gary
>
>
>> Thank you
>>
>> Roberto
>>
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Gary Sherman
>
> Founder, QGIS Project
> Consulting: geoapt.com
> Publishing: locatepress.com
>
> We work virtually anywhere
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150416/e78adf33/attachment.html>


More information about the Qgis-developer mailing list