[Qgis-developer] Help Needed - How to get the projection parameters for a Raster file

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Nov 2 10:21:49 EDT 2010

On Tue, Nov 2, 2010 at 1:53 PM, Bishwarup Banerjee
<bishwarup.banerjee at gmail.com> wrote:
> Dear All,
> Can any body help me to get and set projection parameters for raster files?
> I am doing some map calculation using PIL and the data is losing projection,
> so want to re project the raster files.
> The language I am using is Python on windows platform..

 Assuming this is a qgis question...

 If you get the layer in 'l' then l.crs() gets you a coordinate
reference system object:

>>> l.crs()
<qgis.core.QgsCoordinateReferenceSystem object at 0xb3b44ac>

and hence:

>>> l.crs().toProj4()
PyQt4.QtCore.QString(u'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')

 and to set it, just use setCrs with a QgsCoordinateReferenceSystem object.


More information about the Qgis-developer mailing list