[Proj] proj-4.6.0 and BETA2007.gsb

Oliver Eichler oliver.eichler at dspsolutions.de
Mon Jan 21 11:32:01 EST 2008


Hi Frank,
>
> I think your problem is the coordinate system definition.  It includes
> +datum=potsdam and +nadgrids. These will conflict and it isn't
> necessarily
> clear whether PROJ.4 will use the +towgs84 definition expanded from the
> +datum, or will use the +nadgrids values.  I'd guess the potsdam datum
> was unknown (and so unexpanded) in the older version and now it does get
> expanded and the towgs84 used instead of the nadgrids statement.  Instead
> try using:
>
> +proj=tmerc +lat_0=0 +lon_0=12 +k=1.000000 +x_0=4500000 +y_0=0
>   +ellps=bessel +units=m +no_defs  +nadgrids=./BETA2007.gsb
>

I wish it would be that simple :) That Potsdam datum is not my idea.
It's from a GeoTiff which I created with your tools by following code:

...
snprintf(strProj,sizeof(strProj),"+proj=tmerc +lat_0=0 +lon_0=%i
+k=1.000000 +x_0=%i +y_0=0 +ellps=bessel +units=m +no_defs", lon_0,
500000 + (lon_0/3) * 1000000);

OGRSpatialReference oSRS;
oSRS.importFromProj4(strProj);
oSRS.exportToWkt(&ptr);
dataset->SetProjection(ptr);

CPLFree(ptr);
...

gdalinfo tells me:

...
Coordinate System is:
PROJCS["unnamed",
    GEOGCS["DHDN",
        DATUM["Deutsches_Hauptdreiecksnetz",
            SPHEROID["Bessel 1841",6377397.155,299.1528128000008,
                AUTHORITY["EPSG","7004"]],
            AUTHORITY["EPSG","6314"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4314"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",12],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",4500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
...

And if I read the GeoTiff again I restore the projection by:
...
    char str[1024];
    strncpy(str,dataset->GetProjectionRef(),sizeof(str));
    char * ptr = str;
    OGRSpatialReference oSRS;
    oSRS.importFromWkt(&ptr);
    oSRS.exportToProj4(&ptr);
    strProj = ptr;
    strProj += " +nadgrids=./BETA2007.gsb";
    qDebug() << strProj;
    pj = pj_init_plus(strProj.toLatin1());
...

You see, no Potsdam datum to remove anywhere :) At least not visible for
me - ok I am still a noob to that stuff.

Oliver







More information about the Proj mailing list