[Qgis-developer] OGRSpatialReference problem in QGIS

Jürgen E. Fischer jef at norbit.de
Mon Aug 17 11:18:38 EDT 2009


Hi Florian,

On Mon, 17. Aug 2009 at 16:42:13 +0200, Florian Hillen wrote:
>     OGRSpatialReference oSRS;
> 
>     long epsg = projectSelector->selectedEpsg();
> 
>     if(epsg == 0)
>         return false;
> 
>     if(epsg == 4326)
>     {
>         QString epsgString;
>         epsgString.setNum(epsg);
>         epsgString.prepend("EPSG:");
>         oSRS.SetWellKnownGeogCS(epsgString.toUtf8());
>     }
>     else
>     {
>         oSRS.SetProjCS((projectSelector->selectedName()).toUtf8());
>         oSRS.importFromProj4((projectSelector->selectedProj4String()).toUtf8());
>     }
> 
>     oSRS.exportToWkt( &pszDstWKT );

What about avoiding the problem with something similar to this?

QString wkt = QgsCoordinateReferenceSystem(
		projectionSelector->selectedCrsId(),
		QgsCoordinateReferenceSystem::InternalCrsId ).toWkt();


I would try to avoid the C++-API and use the C-API to avoid ABI headaches.


Jürgen

-- 
Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-20
Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
Software Engineer         D-26506 Norden               http://www.norbit.de

-- 
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502



More information about the Qgis-developer mailing list