[gdal-dev] OGRSpatialReference problem in QGIS

Florian Hillen fhillen at uni-osnabrueck.de
Mon Aug 17 10:40:44 EDT 2009

Hi list,

I have a problem with OGR, more precisely with OGR in Quantum GIS.

For my Plugin which reprojects rasterdata to another CS, I need a WKT
description of the new CS. With the class "QgsProjectionSelector" of
Quantum GIS I can select a CS and read out the epsg code or the proj4
string. But I fail by setting this to an OGRSpatialReference and export
that to a WKT.
If I transform a 4326 scene with my plugin to 31467 (german system), the
gdal warp works correctly (the coordinates are right), but the information
about the geocs looks like this:


Here is the code in which I set the OSR:

    OGRSpatialReference oSRS;

    long epsg = projectSelector->selectedEpsg();

    if(epsg == 0)
        return false;

    if(epsg == 4326)
        QString epsgString;

    oSRS.exportToWkt( &pszDstWKT );

The if-clause for 4326 was just a try to use an other function, so don't
focus on that too much.

So can anyone help me with that?
Do I have to use the C-API for that? I already had problems with the C++
API of GDAL in Quantum GIS. My first attempt with the C-API for OGR wasn't
successful either, that's why I asked you for a hint.

Thanks in advance and best regards,

More information about the gdal-dev mailing list