[QGIS-trac] [Quantum GIS] #2913: a simple ogr2ogr interface will
ease coordinate transformations with +towg84 or +nadgrids parameters
Quantum GIS
qgis at qgis.org
Thu Jul 29 14:47:48 EDT 2010
#2913: a simple ogr2ogr interface will ease coordinate transformations with
+towg84 or +nadgrids parameters
------------------------------------------------+---------------------------
Reporter: lutra | Owner: borysiasty
Type: enhancement | Status: new
Priority: major: does not work as expected | Milestone: Version 1.6.0
Component: Python plugins and bindings | Version: Trunk
Keywords: | Platform_version:
Platform: All | Must_fix: No
Status_info: 0 |
------------------------------------------------+---------------------------
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?".
[[BR]]
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.
[[BR]]
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
[[BR]]
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
{{{
/usr/share/proj/
}}}
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.
[[BR]]
Another important note:
*) when you use the +nadgrids parameter you must also add the "+wktext"
one, otherwise "+nadgrids" will be ignored/stripped.
--
Ticket URL: <https://trac.osgeo.org/qgis/ticket/2913>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats
More information about the QGIS-trac
mailing list