[gdal-dev] ogr2ogr natgrids option ignored?
Frank Warmerdam
warmerdam at pobox.com
Fri Jul 10 11:13:08 EDT 2009
Sven Geggus wrote:
> Hi there,
>
> looks like ogr2ogr just ignores my nadgrids projection parameters :(
>
> Here is what I have:
>
> ogr2ogr -s_srs '+proj=tmerc +lat_0=0 +lon_0=12 +x_0=4500000 +y_0=0 \
> +k=1.000000 +ellps=bessel +units=m +nadgrids=./BETA2007.gsb' \
> -t_srs '+proj=longlat +datum=WGS84' -f "ESRI Shapefile" out.shp in.shp
>
> ogr2ogr -s_srs epsg:31468 -t_srs epsg:4326 -f "ESRI Shapefile" out.shp in.shp
>
> While the latter works fine. The first version does not seem to honor the
> nadgrids Option. This is at least what strace hints me to. The command does
> not even try to open the BETA2007.gsb file.
>
> Testing the same Parameters wirth cs2cs does work as expected and
> BETA2007.gsb _is_ honored:
>
> echo 4450457 5487214 | cs2cs -f "%.12f" +proj=tmerc +lat_0=0 +lon_0=12 \
> +x_0=4500000 +y_0=0 +k=1.000000 +ellps=bessel +units=m \
> +nadgrids=./BETA2007.gsb +to +init=epsg:4326
Sven,
The thing to know about using PROJ.4 strings with GDAL/OGR is that GDAL/OGR
internally turns them into WKT. Anything in a PROJ.4 string that is not
preserved in the WKT is lost - and this includes nadgrids directives for
which there is no obvious WKT analog.
One workaround is to add +wktext to the PROJ.4 definition. This tells
GDAL to embed a complete copy of the PROJ.4 definition in the WKT as
an EXTENSION element so the original PROJ.4 string can be reconsistuted
exactly later.
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 gdal-dev
mailing list