[gdal-dev] How to set GDAL/cs2cs/proj to use NTv2 grid shift file when using EPSG codes?

Thomas Campagne thomasc at mirageoscience.com
Fri May 17 10:00:47 PDT 2013


I am running GDAL (1.9.2-2) and PROJ4 (4.8.0-0) installations on Windows 7.
I have two installs of the latest release one through the osgeo4w setup and another with my PythonXY install. 

With osgeo4w the files are in :
C:\OSGeo4W\share\gdal  (contains csv files, and pci_datum.txt seems to contain references to grid shift files but not to EPSG codes)
C:\OSGeo4W\share\proj (contains an epsg file and the grid shift files with few lines containing the +nadgrids=@null parameter)

When I run cs2cs -v +init=epsg:4267 I still do not understand how the +nadgrids=@conus, at alaska, at ntv2_0.gsb, at ntv1_can.dat parameter is being generated as I cannot find it within the text/csv files.

With PythonXY the files are in:
C:\Python27\GDAL\data    (contains csv files, and pci_datum.txt seems to contain references to grid shift files but not to EPSG codes)
C:\Python27\Lib\site-packages\pyproj\data  (contains an epsg file and the grid shift files with few lines containing the +nadgrids=@null parameter)

I thought about editing relevant files of my GDAL and PROJ4 installation but I could not understand which one as I based my search on the NAD27/NAD83 datum shift and could not understand how it is working...

Any idea about which files to edit to add the nadgrids parameter to the proj string referenced by a given EPSG code (4202 for AGD66 as example)?

Thomas

-----Original Message-----
From: Hermann Peifer [mailto:peifer at gmx.eu] 
Sent: May-17-13 7:36 AM
To: Thomas Campagne
Subject: Re: How to set GDAL/cs2cs/proj to use NTv2 grid shift file when using EPSG codes?

What about editing relevant files of your GDAL and PROJ4 installation, as a diry quick hack?

On my MacBook, I would look for the csv files at /opt/local/share/gdal/ and the epsg file at /opt/local/share/proj/

/opt/local/share/proj/ is also the directory where I put extra grid shift files like OSTN02_NTv2.gsb and BETA2007.gsb

Hermann

On 2013-05-16 19:56, Thomas Campagne wrote:
> Hi,
>
> I am using the GDAL API for Python for a script that takes only EPSG 
> codes for inputs to specify source and target coordinate systems.
>
> While the cs2cs command seems to handle quite well transformation 
> between NAD27 (EPSG:4267) and NAD83 (EPSG:4326) coordinates in North 
> America, I would like to have similar capabilities for AGD66 
> (EPSG:4202) to GDA94 (EPSG:4283) and AGD84 (EPSG:4203) to GDA94 
> (EPSG:4283) in Australia.
>
> When using the -v option with cs2cs to look at the proj string being 
> used i get the following:
>
>      >cs2cs -v +init=epsg:4267
>
>      ># ---- From Coordinate System ----
>
>      >#Lat/long (Geodetic alias)
>
>      >#
>
>      ># +init=epsg:4267 +proj=longlat +datum=NAD27 +no_defs 
> +ellps=clrk66
>
>      ># +nadgrids=@conus, at alaska, at ntv2_0.gsb, at ntv1_can.dat
>
>      ># ---- To Coordinate System ----
>
>      >#Lat/long (Geodetic alias)
>
>      >#
>
>      ># +proj=latlong +datum=NAD27 +ellps=clrk66
>
>      ># +nadgrids=@conus, at alaska, at ntv2_0.gsb, at ntv1_can.dat
>
> The nadgrids parameters tells cs2cs to use the best fitting datum grid 
> shift file from conus, alaska, ntv2_0.gsb, and ntv1_can.dat.
>
> For AGD66 (EPSG:4202) cs2cs returns:
>
>      >cs2cs -v +init=epsg:4202
>
>      ># ---- From Coordinate System ----
>
>      >#Lat/long (Geodetic alias)
>
>      >#
>
>      ># +init=epsg:4202 +proj=longlat +ellps=aust_SA
>
>      ># +towgs84=-117.808,-51.536,137.784,0.303,0.446,0.234,-0.29 
> +no_defs
>
>      ># ---- To Coordinate System ----
>
>      >#Lat/long (Geodetic alias)
>
>      >#
>
>      ># +proj=latlong +ellps=aust_SA
>
>      ># +towgs84=-117.808,-51.536,137.784,0.303,0.446,0.234,-0.29
>
> There is no nadgrids parameter but a towgs84 instead. A grid shift 
> file from the ICSM; "A66 National (13.09.01).gsb" contains the shift 
> between
> AGD66 and GDA94.
>
> How can I make GDAL/cs2cs/proj identify this file when using EPSG codes?
>
> I tried to reinstall GDAL/cs2cs/proj using the osgeo4w installer with
> A66 National (13.09.01).gsb within the directory containing the other 
> datum shift files prior to the reinstallation but without success.
>
> I also posted an enhancement ticket on Trac:
>
> http://trac.osgeo.org/gdal/ticket/5085
>
> Cheers
>
> Thomas
>
> *Description: cid:image002.gif at 01CBC6E3.6EDE0130*
>
> *Thomas Campagne, M.Sc. Geophysics, Consultant
> **A**DVANCED**G**EOPHYSICAL**I**NTERPRETATION**C**ENTRE**
> *www.MiraGeoscience.com <http://www.mirageoscience.com/>**tel +1 778 
> 329
> 0430 ext 227, 512B - 409 Granville St, Vancouver, BC, V6C 1T2, Canada
>
> **
>
> *+ *Our Q2 eNewsletter 2013 is now out!You may download it here 
> <http://goo.gl/9GDBi>.
>
> + August 11-14 We will be hosting a workshop at the ASEG Conference in
> Melbourne, Australia. Stop by Booth 49. More details here 
> <http://www.mirageoscience.com/events/upcoming_events.php>.
>
> + August 12-15 We will be hosting a workshop at the SGA Biennial 
> + Meeting
> in Uppsala, Sweden. More details here
> <http://www.mirageoscience.com/events/upcoming_events.php>.
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



More information about the gdal-dev mailing list