[Gdal-dev] using nad grid within ogr2ogr

Frank Warmerdam warmerdam at pobox.com
Thu Apr 12 17:52:41 EDT 2007


Jeremy Palmer wrote:
> Hi,
>  
> Is is possible to update the projection definitions that ogr2ogr uses to 
> include the use of a custom nad grid? I know you can specific the proj4 
> def on the command line, but it would be useful to be able to update the 
> gdal data defintions files so I can just use the EPSG srid on the 
> command line.
>  
> i.e
>  
> "ogr2ogr -f "Mapinfo File" temp PG:dbname=xxxx -t_srs EPSG:27200 table"
>  
> instead of
>  
> ogr2ogr -f "Mapinfo File" temp PG:dbname=xxxx -t_srs "+proj=nzmg 
> +lat_0=-41 +lon_0=173 +x_0=2510000 +y_0=6023150 +ellps=intl 
> +datum=nzgd49 +units=m +no_defs  <> +nadgrids=nzgd2kgrid0005.gsb" table

Jeremy,

I don't think the above will actually do what you want as the nadgrids
aren't captured when ogr turns the proj.4 definition into an internal
WKT string.

That issue aside, the answer to your question is no.  Grid use is currently
not based on any sort of configuration file.  Instead it is hardcoded into
PROJ.4 for particular +datum= codes - primarily just +datum=NAD27.

What you can do, to force use of a grid in ogr2ogr is similar to what you
did above, but slightly different.

Try using:

"+proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000 +y_0=6023150 +ellps=intl
  +units=m +nadgrids=nzgd2kgrid0005.gsb +wktext"

The +wktext is a special keyword that OGR recognises as meaning
"embed the entire PROJ.4 string in the WKT and use it literally
when converting back to PROJ.4 format".  Internally the above is
converted into this:

PROJCS["unnamed",
     GEOGCS["International 1909 (Hayford)",
         DATUM["unknown",
             SPHEROID["intl",6378388,297]],
         PRIMEM["Greenwich",0],
         UNIT["degree",0.0174532925199433]],
     PROJECTION["New_Zealand_Map_Grid"],
     PARAMETER["latitude_of_origin",-41],
     PARAMETER["central_meridian",173],
     PARAMETER["false_easting",2510000],
     PARAMETER["false_northing",6023150],
     UNIT["Meter",1],
     EXTENSION["PROJ4","+proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000 
+y_0=6023150 +ellps=intl  +units=m +nadgrids=nzgd2kgrid0005.gsb +wktext"]]

I hope this helps.

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    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list