<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal>Good day!<br>
<br>
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.<o:p></o:p></p>
<p class=MsoNormal><br>
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"<br>
<br>
After this has been done successfully, I now want to create a QgsCoordinateReferenceSystem
object from the assigned projection definition as follows:<br>
<br>
<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'><i>GDALDataset *dataset = theDataset;<o:p></o:p></i></p>
<p class=MsoNormal style='text-indent:.5in'><i> QgsCoordinateReferenceSystem
*crs = new QgsCoordinateReferenceSystem();<o:p></o:p></i></p>
<p class=MsoNormal><i> QString
projDefinition = dataset->GetProjectionRef();<o:p></o:p></i></p>
<p class=MsoNormal><i> if(crs->createFromWkt(projDefinition))<o:p></o:p></i></p>
<p class=MsoNormal><i> {<o:p></o:p></i></p>
<p class=MsoNormal><i> return
crs->projectionAcronym();<o:p></o:p></i></p>
<p class=MsoNormal><i> }else<o:p></o:p></i></p>
<p class=MsoNormal><i> {<o:p></o:p></i></p>
<p class=MsoNormal><i> return
"NOT FOUND";<o:p></o:p></i></p>
<p class=MsoNormal><i> }</i><br>
<br>
The projDefinition variable above receives the correct definition string:<br>
<i>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"],PARAMETER["standard_parallel_1",-18],PARAMETER["standard_parallel_2",-36],PARAMETER["latitude_of_center",0],PARAMETER["longitude_of_center",132],PARAMETER["false_easting",0],PARAMETER["false_northing",0]]<o:p></o:p></i></p>
<p class=MsoNormal><i><o:p> </o:p></i></p>
<p class=MsoNormal>But for some reason, the
crs->createFromWkt(projDefinition) returns false every time.<br>
Does anyone know what may be wrong?<br>
<br>
Thank you!<br>
Francois<o:p></o:p></p>
</div>
</body>
</html>