[Qgis-developer] How to get project's CRS in Python

Blumentrath, Stefan Stefan.Blumentrath at nina.no
Wed May 29 03:49:19 PDT 2013


Hi

canvas = self.iface.mapCanvas()
mapRenderer = canvas.mapRenderer()
srs=mapRenderer.destinationCrs()

Then for example
str(srs.authid())
would return for a project in WGS84:
‘EPSG:4326’

Cheers
Stefan

From: qgis-developer-bounces at lists.osgeo.org [mailto:qgis-developer-bounces at lists.osgeo.org] On Behalf Of Ricardo Filipe Soares Garcia da
Sent: 29. mai 2013 12:02
To: qgis-developer at lists.osgeo.org
Subject: [Qgis-developer] How to get project's CRS in Python

Hi list
How could I extract the current project's CRS from python?
I've tried looking for it in QSettings but came up short. Mybe somewhere in QgsProject? I can't figure out how to use the readListEntry() method though.
Thanks

--
___________________________ ___ __
Ricardo Garcia Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130529/40653d3c/attachment.html>


More information about the Qgis-developer mailing list