add support for ntv2 grids and +towgs84 parameters in the "save as..." dialogs
|Reported by:||lutra||Owned by:||nobody|
|Priority:||major: does not work as expected||Milestone:||Version 1.7.0|
|Must Fix for Release:||Yes||Platform:||All|
|Platform Version:||Awaiting user input:||no|
QGIS is great because offer many ways/tools to save copies of vectors and change their projection along the process.
But what about if you want to do the following (example)?
ogr2ogr -f "ESRI Shapefile" -s_srs "+proj=tmerc +lat_0=39.66666666666666 +lon_0=-8.131906111111112 +k=1 +x_0=200000 +y_0=300000 +ellps=intl +units=m +towgs84=-282.1,-72.2,119.95,-1.53,0.14,-0.89,-4.5" -t_srs "+proj=tmerc +lat_0=39.6682583333474 +lon_0=-8.133108333465099 +k=1 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0 +units=m +no_defs" test.shp acid.shp
The problem is that there is no interface in QGIS that allows you to define manually the "-s srs" or "-t srs" parameters (just for vectors, because the "gdal tools" tools do allow you to do so).
You may think "so, what is the deal?".
The other problem is that QGIS does not allow either to choose/define the "+towgs84" or "+nadgrids" parameters so to make things work you will basically have to:
*) define a custom CRS, probably a clone of one already available but with the necessary "+towgs84" or "+nadgrids" parameters.
*) save a copy of your vector giving to him the custom CRS with "+towgs84" or "+nadgrids" parameters
*) save this vector in a new one with the -t srs coordinate system
This is not really straightforward, but it works. So maybe until things will remain this way it would be useful to document this steps.
The proposed ogr2ogr interface would be a very simple "plugin", and as a starting point you may want to have a look to the warp tool in the gdal tools plugin.
Basically what is needed is a GUI that allows to:
*) choose the input vector
*) choose the output vector
*) choose the input srs
*) choose the output srs
AND, if necessary
*) choose/define +towgs84/+nadgrids parameters
A few important notes:
*) when the -t srs is a projected one, it must be defined with a "+towgs84=0,0,0" parameter, otherwise ogr2ogr will ignore the -s srs +towgs84/+nadgrids parameters.
This is important because actually in QGIS you need ALSO to define a custom CRS (for the -t srs parameter) that holds the "+towgs84=0,0,0" string.
*) NTV2 grids are pretty much more accurate than towgs84 parameters for large scale areas. Are binary files (*.gsb) and are freely available for many countries. To work with ogr2ogr they need to be copied to the appropriate system directory, under linux is
once there you can use them like this:
ogr2ogr -f "ESRI Shapefile" -s_srs "+proj=tmerc +lat_0=39.66666666666666 +lon_0=-8.131906111111112 +k=1 +x_0=0 +y_0=0 +ellps=intl +units=m +no_defs +nadgrids=ptLX_e89.gsb +wktext" -t_srs "+init=epsg:4326" area_wgs84.shp area.shp
So for this interface I would also suggest a dropdown to show the already available .gsb files, and a way to let the users choose new .gsb files to be copied to the proper system location.
Another important note:
*) when you use the +nadgrids parameter you must also add the "+wktext" one, otherwise "+nadgrids" will be ignored/stripped.
Change History (6)
comment:2 by , 12 years ago
|Component:||Python plugins and bindings → Data Provider|
|Must Fix for Release:||No → Yes|
|Summary:||a simple ogr2ogr interface will ease coordinate transformations with +towg84 or +nadgrids parameters → add a "SOURCE SRS" option in the "save as..." and "save selection as..." dialogs|
comment:3 by , 12 years ago
|Summary:||add a "SOURCE SRS" option in the "save as..." and "save selection as..." dialogs → add support for ntv2 grids and +towgs84 parameters in the "save as..." dialogs|