[Gdal-dev] datum shift in OGR / proj4

Frank Warmerdam warmerdam at pobox.com
Mon Dec 15 11:23:47 EST 2003


mathieu_gdal wrote:
> Dear All,
> 
> I know the basics of datums concepts, and until now, I was making datum
> conversion with my own code (using in particular the abridged Molodensky
> formula).
> 
> Now, I would like to port my code to OGR.
> Where could I find documentations about how to convert datums with Proj4
> / OGR? 
> In can see in this mailing list some experts talking about "Datum Data
> files". I have my own datum list and file format, so is it possible to
> feed Proj4/OGR with my own datums?
> 
> If you could give me a "starting point" (doc and/or code) to allow me to
> start with OGR and datums, it would be great.

Mathieu,

OGR / PROJ.4 support 3 and 7 parameter datum transformations as well as
grid file driven transformations (used for NAD27 to NAD83 primarily).

At the OGR level you use the 3 and 7 parameter transformations with the
TOWGS84[] item in a WKT coordinate system.  The following is a very simple
made up example of a geographic coordinate system with a datum shift defined
in a TOWGS84 node:

GEOGCS["International 1909 (Hayford)",
     DATUM["unknown",
         SPHEROID["intl",6378388,297],
         TOWGS84[1,2,3,0,0,0,0]],
     PRIMEM["Greenwich",0],
     UNIT["degree",0.0174532925199433]]

The corresponds to the PROJ.4 definition:

+proj=latlong +ellps=intl +towgs84=1,2,3

The grid shift files are only used by OGR when it recognises it is converting
to/from NAD27.   Let me know if you need to tie into that.

So basicaly, you should be able to translate your existing coordinate systems
into WKT definitions that includes the TOWGS84 node for the DATUM, and then
OGR will apply the datum shift during coordinate transformation if required.

You might want to skim:

   http://www.remotesensing.org/gdal/ogr/osr_tutorial.html
   http://www.remotesensing.org/proj/gen_parms.html
   http://www.remotesensing.org/proj/faq.html

Good luck,
-- 
---------------------------------------+--------------------------------------
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