Feature request #2913
add support for ntv2 grids and +towgs84 parameters in the "save as..." dialogs
|Pull Request or Patch supplied:||Resolution:||wontfix|
|Easy fix?:||No||Copied to github as #:||12973|
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.
#2 Updated by Giovanni Manghi about 11 years ago
It is possible to make it simpler -> just add a "SOURCE SRS" option in the "save as..." and "save selection as..." dialogs.
Then it would be needed to add options (in both the vector dialogs and raster dialogs
gdaltools) the options to add/choose towgs84 and nadgrids parameters, but this is another story.
#3 Updated by Giovanni Manghi almost 11 years ago
Follow up description, more resumed and clear (I hope):
I would like to resume better what would be needed to add the support for transformations with ntv2 grids and/or +towsgs84 parameters
a) a new menu to allow a user import ntv2 grids (.gsb files): the same files need to be copied in the proper system location, for example "/etc/proj" for linux
b) add a "source srs" field in the "save as..." and "save selected as..." dialogs
c) in the same dialog add a dropdown to let the user choose the appropriate ntv2 grid, among the ones available in the proper system folder
d) if the user chooses a ntv2 grid the underlying ogr2ogr operation MUST always add the "+wktext" parameter in the source srs definition
e) if the user chooses a ntv2 grid the underlying ogr2ogr operation MUST always add the "+towgs84=0,0,0" parameter in the target srs definition, if this srs is a projected one
f) a field to let the user write manually +towgs84 parameters in case he/she don't want/need to use ntv2 grids. This field and the ntv2 dropdown need to be mutually exclusive.
g) add a windows, like the one that shows in the gdal tools, and show the ogr2ogr command as it is forming while the users chooses the parameters, and make this command editable, like it was already asked for the gdal tools.