[Qgis-developer] OGRSpatialReference problem in QGIS

Florian Hillen fhillen at uni-osnabrueck.de
Mon Aug 17 11:18:17 EDT 2009

Hi Frank,

thanks for the fast answer.
(projectSelector->selectedProj4String()).toUtf8() delivers the following
proj.4 string:

+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel
+datum=potsdam +units=m +no_defs


> Florian Hillen wrote:
>> Hi list,
>> I have a problem 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 QgsProjectionSelector 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:
>> PROJCS["unnamed",PROJECTION["Transverse_Mercator"],
> ...
>>     else
>>     {
>>         oSRS.SetProjCS((projectSelector->selectedName()).toUtf8());
>>         oSRS.importFromProj4((projectSelector->selectedProj4String()).toUtf8());
>>     }
> ...
>> 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.
> Florian,
> What did the Proj4String look like?  The WKT is lacking any description of
> the GEOGCS which suprises me.  I'm not clear on where the proj.4 strings
> in projectSelector->selectedProj4String() come from but if this string is
> reasonable and has earth model information it should be reflected in the
> WKT.
> If not, perhaps I can fix importFromProj4.
> Best regards,
> --
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the Qgis-developer mailing list