[Qgis-developer] OGRSpatialReference problem in QGIS

Frank Warmerdam warmerdam at pobox.com
Mon Aug 17 11:56:44 EDT 2009


Florian Hillen wrote:
> 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,

This proj.4 string works fine for me producing:

PROJCS["unnamed",
     GEOGCS["DHDN",
         DATUM["Deutsches_Hauptdreiecksnetz",
             SPHEROID["Bessel 1841",6377397.155,299.1528128,
                 AUTHORITY["EPSG","7004"]],
             TOWGS84[606,23,413,0,0,0,0],
             AUTHORITY["EPSG","6314"]],
         PRIMEM["Greenwich",0,
             AUTHORITY["EPSG","8901"]],
         UNIT["degree",0.01745329251994328,
             AUTHORITY["EPSG","9122"]],
         AUTHORITY["EPSG","4314"]],
     PROJECTION["Transverse_Mercator"],
     PARAMETER["latitude_of_origin",0],
     PARAMETER["central_meridian",9],
     PARAMETER["scale_factor",1],
     PARAMETER["false_easting",3500000],
     PARAMETER["false_northing",0],
     UNIT["Meter",1]]

I see this code in importFromProj4() for "datum=potsdam":

     else if( EQUAL(pszValue,"potsdam") )
     {
         OGRSpatialReference oGCS;
         oGCS.importFromEPSG( 4314 );
         CopyGeogCSFrom( &oGCS );
         bFullyDefined = TRUE;
     }

This leads me to suspect that the EPSG .csv files are not being found.  These
have the names gcs.csv and pcs.csv, are distributed as part of GDAL and are
normally found somewhere like /usr/local/share/gdal/.  When in an unusual
location you can use the GDAL_DATA environment variable to point to the
directory holding them.

This import code should really have some error checking to propogate a failure
in importFromEPSG() back to the importFromProj4() caller.  If you would file
a GDAL ticket on this issue, I'll have someone work on improving the error
handling.  But the core solution is to ensure the support files are available
and findable.

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