Thanks Martin I did see coordinateTransform after posting this request. I was still concerned that coordinateTransform might be null if there was no tranformation required (eg OTF transformations not enabled, or source and dest CRS are the same. However I have seen that in this case the coordinateTransform is still populated, so this is a good option for me.
Thanks also for suggestion of extracting layer infomation when the renderer is created.. Chris ________________________________________ From: Martin Dobias [[email protected]] Sent: 13 September 2016 15:26 To: Chris Crook Cc: [email protected] Subject: Re: [Qgis-developer] QgsFeatureRendererV2.startRender deprecated ... Hi Chris On Mon, Sep 12, 2016 at 10:18 AM, Chris Crook <[email protected]> wrote: > Hi All > > > > I see that the version of QgsFeatureRendererV2.startRender taking a > QgsVectorLayer as a second parameter is deprecated in favour of a version > taking a field list. Yes it has been deprecated because since 2.4 rendering is normally done in a worker thread and having direct access to the layer would be unsafe. > In particular I want to get the layer CRS in order to determine the > relationship between true north and projection north, so that I can apply > this rotation to the symbol. It is not clear to me where I can get this > from once the deprecated implementation of startRender is removed. Possibly > this could be added to the QGS render context? I can access coordinate > transformations there, but I don't see that as a guaranteed API for getting > the source CRS. Any suggestions? One can get source CRS from the coordinate transform (from render context): context.coordinateTransform().sourceCrs() - why isn't that a guaranteed API? An alternative would be to pass layer's CRS to the renderer object when the renderer is created. Regards Martin This message contains information, which may be in confidence 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 [email protected]) 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. _______________________________________________ Qgis-developer mailing list [email protected] List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
