[gdal-dev] how to use the -ct option in ogr2ogr

Karsten Tebling tebling at masuch.de
Mon Feb 8 01:23:13 PST 2021


gdalinfo for NTv2LSBB_LSA.gsb gave the following information:

Size is 256, 264
Coordinate System is: EPSG 4326
Origin: 10.5, 53.1
SYSTEM_F: S4283
SYSTEM_T: ETRS89
Upper Left 10.5, 53.1
Lower Left 10.5, 50.9
Upper Right 13.3, 53.1
Lower Right 13.3, 50.9

ogrinfo for punkte_31468.dxf gave the following information:

Geometry: Unknown (any)
Feature Count: 36
Extent: (4523806.5, 5758974.7) - (4524134.7, 5759234.0)
Layer SRS WKT: (unknown)

according to QGIS punkte_31468.dxf should be at 11.6 52.1 which is 
inside the extent of the NTv2LSBB_LSA.gsb. after checking the 
documentation for the NTv2LSBB_LSA.gsb i noticed i couldn't use it for 
transformations from 31468 to 25833, that's why i tried it with 
BETA2007.gsb instead, but it didn't work either - it gave the same errors.

gdalinfo for BETA2007.gsb gave the following information:

Size is 62, 84
Coordinate System is: EPSG 4326
Origin: 5.4, 55.4
SYSTEM_F: DHDN90
SYSTEM_T: ETRS89
Upper Left 5.4, 55.4
Lower Left 5.4, 47.0
Upper Right 15.8, 55.4
Lower Right 15.6, 47.0

my adjusted code for BETA2007.gsb looks like:

ogr2ogr -s_srs "EPSG:31468" -t_srs "EPSG:25833" -dim XYZ -ct 
"+proj=pipeline +step +inv +proj=tmerc +lat_0=0 +lon_0=12 +k=1 
+x_0=4500000 +y_0=0 +ellps=bessel +step +proj=hgridshift 
+grids=BETA2007.gsb +step +proj=utm +zone=33 +ellps=GRS80" -f DXF 
punkte_25833.dxf punkte_31468.dxf

the points i used to test this were digitized around Magdeburg, 
Saxony-Anhalt in EPSG:31468. according to aerial data and openstreetmap, 
the position and coordinate system are correct when i check it in QGIS 
and switch to different coordinate systems.

Am 06.02.2021 um 22:24 schrieb Markus Metz:
>
>
> On Fri, Feb 5, 2021 at 3:40 PM Karsten Tebling <tebling at masuch.de 
> <mailto:tebling at masuch.de>> wrote:
> >
> > Hello,
> >
> > i'm struggling with how to use the -ct option in ogr2ogr and could need
> > some help.
> >
> > i copied a NTv2.gsb to osgeo4w64/share/proj and edited the proj.db by
> > inserting a new row in the grid_transformation-table. using this
> > transformation in qgis works. however when i try to use it in ogr2ogr
> > with the same data i always get "failed to reproject feature (geometry
> > probably out of source or destination srs). no known way to write
> > feature with geometry 'none'". here is my code:
> >
> > ogr2ogr -s_srs "EPSG:31468" -t_srs "EPSG:25833" -dim XYZ -ct
> > "+proj=pipeline +step +inv +proj=tmerc +lat_0=0 +lon_0=12 +k=1
> > +x_0=4500000 +y_0=0 +ellps=bessel +step +proj=hgridshift
> > +grids=NTv2LSBB_LSA.gsb +step +proj=utm +zone=33 +ellps=GRS80" -f DXF
> > punkte_25833.dxf punkte_31468.dxf
> >
>
> Is the grid NTv2LSBB_LSA.gsb used for hgridshift really covering the 
> full extent of punkte_31468.dxf ?
> You can check with "gdalinfo NTv2LSBB_LSA.gsb" and "ogrinfo -so 
> punkte_31468.dxf".
>
> Markus M
>
> > i'm using the latest qgis-ltr and osgeo4w shell
> >
> > greetings
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
> > https://lists.osgeo.org/mailman/listinfo/gdal-dev 
> <https://lists.osgeo.org/mailman/listinfo/gdal-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210208/55952e42/attachment.html>


More information about the gdal-dev mailing list