[gdal-dev] NTv2 geographic transformation
Frank Warmerdam
warmerdam at pobox.com
Thu Jul 7 08:59:43 EDT 2011
On Thu, Jul 7, 2011 at 2:38 AM, jblazquez <jiblazquezmozun at gmail.com> wrote:
> Hi
> I'm trying to make a transformation between ud50 and etrs98 for some files
> shp. This transformation must do it through the grid system (NTv2). To do
> this I have the official transformation file
> (http://www.ign.es/ign/layoutIn/herramientas.do). I read that 1.8 has a GDAL
> driver specific to that transformation. The sample script that exists in the
> install package (GDAL-1.8.0 \ swig \ python \ samples \ loslas2ntv2.py) is
> valid only for transforming images.
> My issue is to know how I can make this transformation vector files
jblazquez,
The introduction of the NTv2 driver in GDAL was done so that NTv2 files
could be produced more easily from other sources. It is not involved in
*utilizing* the NTv2 files for geometric transformations.
PROJ.4 actually applies the NTv2 transformations but it can be invoked
from ogr2ogr.
Hopefully you can do something like:
ogr2ogr \
-s_srs WGS84
-t_srs "+proj=latlong +ellps=WGS84 +nadgrids=./your.ntv2 +wktext"
out.shp in.shp
The above assumes the coordinates are geographic (lat/long decimal
degrees). The thing to keep in mind is that PROJ.4 only knows about
transforming to and from WGS84. So you need to trick it into thinking
that one coordinate system is WGS84 and the other is something
different which the grid shift file.
Note, I'm vague on what direction the transformation is stored in within
the NTv2 file, so you may find that the example I gave moves things
the wrong way. If so, just switch -t_srs and -s_srs around.
It would be nice to have a real world, tested, example of this in the
Trac wiki as the question does come up fairly often.
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