[Qgis-developer] QgsCoordinateReferenceSystem - Projections

Francois Maass fieliesm at gmail.com
Sun Oct 3 09:39:06 EDT 2010


Good day!

I have a GDALDataset that I create from an image.  I've used one of the
projection strings that the QGIS Projection Dialog returns, to set the
projection definition of this dataset.   I also used the
QgsCoordinateReferenceSystem class to convert the string to Wkt format, in
order to assign the projection to the image.


Used: "+proj=aea +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=132 +x_0=0 +y_0=0
+ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"

After this has been done successfully, I now want to create a
QgsCoordinateReferenceSystem object from the assigned projection definition
as follows:

                

GDALDataset *dataset = theDataset;

 QgsCoordinateReferenceSystem *crs = new QgsCoordinateReferenceSystem();

                QString projDefinition = dataset->GetProjectionRef();

                if(crs->createFromWkt(projDefinition))

                {

                                return crs->projectionAcronym();

                }else

                {

                                return "NOT FOUND";

                }

The projDefinition variable above receives the correct definition string:
PROJCS["unnamed",GEOGCS["Unknown datum based upon the GRS 1980
ellipsoid",DATUM["Not specified (based on GRS 1980 spheroid)",SPHEROID["GRS
1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]]],PRIMEM["Greenwich",0]
,UNIT["degree",0.0174532925199433]],PROJECTION["Albers_Conic_Equal_Area"],PA
RAMETER["standard_parallel_1",-18],PARAMETER["standard_parallel_2",-36],PARA
METER["latitude_of_center",0],PARAMETER["longitude_of_center",132],PARAMETER
["false_easting",0],PARAMETER["false_northing",0]]

 

But for some reason, the crs->createFromWkt(projDefinition) returns false
every time.
Does anyone know what may be wrong?

Thank you!
Francois

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20101003/bbdfdd38/attachment.html


More information about the Qgis-developer mailing list