[GRASS-dev] [GRASS GIS] #1988: towgs84 datum transform options not maintained with shapefile export
GRASS GIS
trac at osgeo.org
Mon Jun 3 21:34:13 PDT 2013
#1988: towgs84 datum transform options not maintained with shapefile export
--------------------------------+-------------------------------------------
Reporter: voncasec | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Projections/Datums | Version: unspecified
Keywords: g.proj, v.out.ogr | Platform: Linux
Cpu: x86-64 |
--------------------------------+-------------------------------------------
Comment(by hamish):
Casey wrote: (grass-dev ML)
> Thanks Hamish,
>
> I assumed it needed to be looked at with GDAL/OGR first when exporting
> to a shapefile, I just wasn't sure if this was also the case when using
> g.proj -e.
Hi,
I did a little digging. You get the TOWGS84 in the WKT if you use 'g.proj
-w' and your PERMANENT/PROJ_INFO file has a towgs84 line, but not 'g.proj
-we' (-e modifies -w, and triggers it because it implies it). Grid datum
transform files are not handled by any variant of Well Known Text afaik (a
slight correction to my last comment), except perhaps by using a custom
osgeo-family "EXTENSION" keyword, which I'm not sure has been commonly
defined yet.
So the good news is that for generic Shapefile export you could leave off
the v.out.ogr/g.prok '-e' flag to use generic WKT, which supports TOWGS84.
For export to ESRI products it would be lost though, as ESRI apparently
(according to the OGR code) doesn't support TOWGS84 statements in the WKT.
specifically 'g.proj -we' calls GPJ_grass_to_wkt() which if the ESRI-
compatibility flag is given calls OGR's OSRMorphToESRI() (aka
morphToESRI()).
morphToESRI() has this comment as it strips away any TOWGS84:
{{{
/* -------------------------------------------------------------------- */
/* Strip all CT parameters (AXIS, AUTHORITY, TOWGS84, etc). */
/* -------------------------------------------------------------------- */
}}}
OGR's StripCTParms() is called in to do that:
{{{
* This method will remove all components of the coordinate system
* that are specific to the OGC CT Specification. That is it will attempt
* to strip it down to being compatible with the Simple Features 1.0
* specification.
...
poCurrent->StripNodes( "AUTHORITY" );
poCurrent->StripNodes( "TOWGS84" );
poCurrent->StripNodes( "AXIS" );
poCurrent->StripNodes( "EXTENSION" );
return OGRERR_NONE;
}
}}}
see grass's lib/proj/convert.c and GDAL/OGR's ogr/ogr_srs_esri.cpp +
ogrspatialreference.cpp.
so in the case of 'g.proj -w -e' it behaves as expected, TOWGS84 is
removed on purpose.
hope it helps,
Hamish
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1988#comment:2>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list