[Qgis-developer] (python) access to QgsHillshadeRenderer of raster layer ?

Andreas Plesch andreasplesch at gmail.com
Fri Apr 14 14:10:42 PDT 2017


Hi Nyall,

I got the nightly 2.18.6 32bit release installed (after dealing with the
osgeo4w installer not finding the libmysql package to download) and
rasterlayer.renderer() now returns the the qgshillshaderenderer with the
corresponding azimuth et al. methods. Thanks again !

Andreas

On Sun, Apr 9, 2017 at 7:37 PM, Andreas Plesch <andreasplesch at gmail.com>
wrote:

> Hi Nyall,
>
> wow, that's great. I will try a nightly this week.
>
> -Andreas
>
>
> On Sun, Apr 9, 2017 at 6:53 PM, Nyall Dawson <nyall.dawson at gmail.com>
> wrote:
>
>> On 10 April 2017 at 08:30, Andreas Plesch <andreasplesch at gmail.com>
>> wrote:
>> >> Date: Sat, 8 Apr 2017 13:51:43 -0700 (MST)
>> >> From: Tom Chadwin <tom.chadwin at nnpa.org.uk>
>> >>
>> >> They should be there:
>> >>
>> >> https://qgis.org/api/classQgsHillshadeRenderer.html
>> >>
>> >>
>> >
>> > Thanks. Yes, they are there. The problem is I cannot find a way to get
>> to
>> > the QgisHillshadeRenderer itself, from the QgsRasterLayer.
>> > QgsRasterLayer.renderer() only provides QgsRasterRenderer. Anyways, the
>> > .writeXML approach works well enough. [ It is a bit strange that the
>> > altitude is named angle as an xml attribute. ]
>> >
>> > Ideally, I would want to get the lightAzimuth and lightAltitude values
>> from
>> > the hillshaderendererwidget used in the layer properties gui . Is there
>> a
>> > way to get that from a processing python script (or plugin)? The idea
>> is to
>> > use existing values provided in the nice existing GUIs as much as
>> possible.
>>
>> There was a missing sip cast for QgsHillshadeRenderer - without this
>> in place you only get access to the common QgsRasterRenderer methods.
>>
>> It's fixed in https://github.com/qgis/QGIS/c
>> ommit/8cf5860d72e6c7d4c7345b3a880020263549a93c
>>
>> Nyall
>>
>
>
>
> --
> Andreas Plesch
> 39 Barbara Rd.
> Waltham, MA 02453
>



-- 
Andreas Plesch
39 Barbara Rd.
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170414/660fe902/attachment.html>


More information about the Qgis-developer mailing list