<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=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@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;}
@font-face
        {font-family:"Lucida Calligraphy";
        panose-1:3 1 1 1 1 1 1 1 1 1;}
/* 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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
span.stringliteral
        {mso-style-name:stringliteral;}
.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!<o:p></o:p></p>
<p class=MsoNormal>I am trying to set the Projection Definition for a
GDALDataset as follows (from the GDALWarp API):<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>const
char *pszDstWKT = NULL;<o:p></o:p></span></i></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>OGRSpatialReference
oSRS;<o:p></o:p></span></i></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>oSRS.SetUTM(
11, TRUE );<o:p></o:p></span></i></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>oSRS.SetWellKnownGeogCS(
"WGS84" );<o:p></o:p></span></i></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>oSRS.exportToWkt(
&pszDstWKT );<o:p></o:p></span></i></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p> </o:p></span></i></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>if(GDALSetProjection(srcDataset,
pszDstWKT) == CE_Failure)<o:p></o:p></span></i></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>{
//handle failure<o:p></o:p></span></i></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>{else<o:p></o:p></span></i></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>{<o:p></o:p></span></i></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'> const
char *defString = srcDataset->GetProjectionRef();<o:p></o:p></span></i></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'> cout<<”Length:
“<<strlen(defString)<<endl;<o:p></o:p></span></i></p>
<p class=MsoNormal style='text-indent:.5in'><i><span style='font-size:10.0pt;
font-family:"Arial","sans-serif"'>cout<<”Projection: ”<<defString<<endl;<o:p></o:p></span></i></p>
<p class=MsoNormal><i><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>};<o:p></o:p></span></i></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Firstly, I get a compiler error with the oSRS.exportToWKT
statement:<br>
invalid conversion from ‘const char**’ to ‘char**’. <o:p></o:p></p>
<p class=MsoNormal><span style='font-family:Wingdings'>à</span> So I changed
the const char* to char*, which bypassed that little error.<o:p></o:p></p>
<p class=MsoNormal><span style='font-family:Wingdings'>à</span> As this was
used exactly as the GDALWarp API Tutorial describes, why does this happen?<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Secondly, After the GDALSetProjection(…) call
succeeds, the projection information is supposed to be printed out to standard
out, along with the length of the definition string.<br>
However, the output is as follows:<br>
$ Length: 0<o:p></o:p></p>
<p class=MsoNormal> $ Projection: <o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal>Why is the projection string still empty? <o:p></o:p></p>
<p class=MsoNormal>I know that the pszDstWKT contains the projection
information as set up, since when printed out to screen it’s displayed
correctly.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Thank you in advance!!<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='font-family:"Lucida Calligraphy"'>Warm Regards<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Lucida Calligraphy"'>Francois
Maass<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Lucida Calligraphy"'>B.IT<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Lucida Calligraphy"'>University of
Pretoria<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Lucida Calligraphy"'>Cell: 072 397
0294<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Lucida Calligraphy"'>Email:
fieliesm@gmail.com<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>