I think this is probably what you're looking for: crs = QgsCoordinateReferenceSystem () crs.createFromProj4(theProj4Str) print crs.toWkt()
no need to use additional libraries or anything! On 29 September 2010 17:18, Benoit de Cabissole <[email protected]> wrote: > Hi Francois, > > If you are in Python, you could use GDAL with something like the following: > > import osr > ... > theProj4Str = "+proj=utm +zone=36 +south +a=6378249.144808011 > +b=6356514.966204134 +units=m +no_defs" > outSr = osr.SpatialReference() > outSr.ImportFromProj4(theProj4Str) > outWkt = outSr.ExportToWkt() > > and use outWkt as the 'dst_wtk' parameter for raster creation. > > HTH, > Benoit > > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]]on Behalf Of Francois Maass > Sent: Wednesday, 29 September 2010 17:33 > To: [email protected] > Subject: [Qgis-developer] QGis AutoGCP Plugin > > Hello everyone! > > > > I’ve been struggling with this for quite some time now, but I can’t seem to > find the proper solution. We need to set the projection definition to > provided datasets, and have, up to now, been doing it by using our own > projection dialog. We now want to change our plugin to use the, already > implemented, QGIS projection dialog. > > So my question is as follows: > > Is there a way to convert a projection definition such as those returned by > the QGIS projection dialog > eg: > +proj=utm +zone=36 +south +a=6378249.144808011 +b=6356514.966204134 > +units=m +no_defs > > to the extended form such as the following: > > PROJCS["UTM Zone 36, Southern Hemisphere",GEOGCS["Unknown datum based > upon the Clarke 1880 ellipsoid",DATUM["Not specified (based on Clarke 1880 > spheroid)",SPHEROID["Clarke > 1880",6378249.144808011,293.4663076556303,AUTHORITY["EPSG","7034"]]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",33],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]] > > > > The reason for this is that the GDAL functions for setting the projection > definition, only accepts the extended form. If this is already implemented > in a QGIS or other class that you know of, I would greatly appreciate it. > (I don’t think I am qualified enough to attempt doing it myself. J ) > > Thank you for your time and efforts! > Francois Maass > Foxhat Solutions > > _______________________________________________ > Qgis-developer mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/qgis-developer > > -- Carson J. Q. Farmer ISSP Doctoral Fellow National Centre for Geocomputation National University of Ireland, Maynooth, http://www.carsonfarmer.com/ _______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
