Good day!

I am trying to set the Projection Definition for a GDALDataset as follows
(from the GDALWarp API):

 

const char *pszDstWKT = NULL;

OGRSpatialReference oSRS;

oSRS.SetUTM( 11, TRUE );

oSRS.SetWellKnownGeogCS( "WGS84" );

oSRS.exportToWkt( &pszDstWKT );

 

if(GDALSetProjection(srcDataset, pszDstWKT) == CE_Failure)

{ //handle failure

{else

{

            const char *defString = srcDataset->GetProjectionRef();

            cout<<”Length: “<<strlen(defString)<<endl;

cout<<”Projection: ”<<defString<<endl;

};

 

Firstly, I get a compiler error with the oSRS.exportToWKT statement:
invalid conversion from ‘const char**’ to ‘char**’.  

à So I changed the const char* to char*, which bypassed that little error.

à As this was used exactly as the GDALWarp API Tutorial describes, why does
this happen?

 

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.
However, the output is as follows:
                $ Length: 0

                $ Projection: 

                

Why is the projection string still empty?  

I know that the pszDstWKT contains the projection information as set up,
since when printed out to screen it’s displayed correctly.

 

Thank you in advance!!

 

Warm Regards

Francois Maass

B.IT

University of Pretoria

Cell: 072 397 0294

Email: fieli...@gmail.com

 

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to