Ticket #1574 (closed defect: fixed)
+towgs84 parameter ignored using gdalwarp
| Reported by: | jachym | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.4.2 |
| Component: | GDAL_Raster | Version: | 1.4.0 |
| Severity: | normal | Keywords: | gdalwarp, krovak |
| Cc: | neteler |
Description
When using gdalwarp on GeoTIFF raster file and comparing the result with r.proj module in GRASS GIS, it seems so, that gdalwarp does not use the +towgs84 parameter:
1) Using gdalwarp
==================
$ gdalinfo QBsubset.TIF
Driver: GTiff/GeoTIFF
Size is 317, 317
Coordinate System is `'
Origin = (746558.400000000023283,5496931.200000000186265)
Pixel Size = (2.400000000000000,-2.400000000000000)
Corner Coordinates:
Upper Left ( 746558.400, 5496931.200)
Lower Left ( 746558.400, 5496170.400)
Upper Right ( 747319.200, 5496931.200)
Lower Right ( 747319.200, 5496170.400)
Center ( 746938.800, 5496550.800)
Band 1 Block=317x12 Type=UInt16, ColorInterp=Gray
Band 2 Block=317x12 Type=UInt16, ColorInterp=Undefined
Band 3 Block=317x12 Type=UInt16, ColorInterp=Undefined
Band 4 Block=317x12 Type=UInt16, ColorInterp=Undefined
$ gdalwarp -s_srs "+ellipsoid=WGS84 +proj=utm +zone=33" -t_srs "epsg:2065" QBsubset.TIF QBsubset-jtsk.tif
$ gdalinfo QBsubset-jtsk.tif
Driver: GTiff/GeoTIFF
Size is 355, 355
Coordinate System is:
PROJCS["S-JTSK (Ferro) / Krovak",
GEOGCS["S-JTSK (Ferro)",
DATUM["S_JTSK_Ferro",
SPHEROID["Bessel 1841",6377397.155,299.1528128000008,
AUTHORITY["EPSG","7004"]],
AUTHORITY["EPSG","6818"]],
PRIMEM["Ferro",-17.66666666666667],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4818"]],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","2065"]]
Origin = (-464078.173189933761023,-1131377.828972819726914)
Pixel Size = (2.398827733050111,-2.398827733050111)
Metadata:
AREA_OR_POINT=Area
Corner Coordinates:
Upper Left ( -464078.173,-1131377.829)
Lower Left ( -464078.173,-1132229.413)
Upper Right ( -463226.589,-1131377.829)
Lower Right ( -463226.589,-1132229.413)
Center ( -463652.381,-1131803.621)
Band 1 Block=355x11 Type=UInt16, ColorInterp=Gray
Band 2 Block=355x11 Type=UInt16, ColorInterp=Undefined
Band 3 Block=355x11 Type=UInt16, ColorInterp=Undefined
Band 4 Block=355x11 Type=UInt16, ColorInterp=Undefined
with
gdalwarp -s_srs "+ellipsoid=WGS84 +proj=utm +zone=33" -t_srs "+proj=krovak +ellipsoid=bessel +towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56" QBsubset.TIF QBsubset-jtsk.tif
the result is just the same (IMHO should not be(?))
2) Using r.proj (GRASS GIS 6.3)
===============================
created location UTM zone 33:
GRASS6.3.cvs utm33/jachym: tmp >g.proj -w
PROJCS["UTM Zone 33, Northern Hemisphere",
GEOGCS["wgs84",
DATUM["unknown",
SPHEROID["WGS_1984",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",15],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["meter",1]]
imported the data
GRASS6.3.cvs utm33/jachym: tmp > g.region -g n=5496931.2 s=5496170.4 w=746558.4 e=747319.2 nsres=2.4 ewres=2.4 rows=317 cols=317 cells=100489
getting bbox coordinates for new Krovak location:
GRASS6.3.cvs utm33/jachym: tmp > echo "746558.4 5496170.4"|cs2cs +proj=utm +ellipsoid=WGS84 +zone=33 +to +proj=krovak +ellipsoid=bessel +towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56 -463951.58 -1132011.59 -42.36 GRASS6.3.cvs utm33/jachym: tmp > echo "747319.2 5496931.2"|cs2cs +proj=utm +ellipsoid=WGS84 +zone=33 +to +proj=krovak +ellipsoid=bessel +towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56 -463099.38 -1131355.44 -42.34
creating new krovak location
coord system: krovak
specify datum: yes
datum: hermannskogel
transformation parameters: 3
GRASS6.3.cvs jtskutm/jachym: tmp > g.region n=-1131355.44 s=-1132011.59 e=-463099.38 w=-463951.58
zooming out, the rasters are a bit rotated and can not fit to such region
GRASS6.3.cvs jtskutm/jachym: tmp > g.proj -w
PROJCS["Krovak",
GEOGCS["bessel",
DATUM["Militar_Geographische_Institut",
SPHEROID["Bessel_1841",6377397.155,299.1528128],
TOWGS84[570.8,85.7,462.8,4.998,1.587,5.261,3.56]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Krovak"],
PARAMETER["latitude_of_center",0],
PARAMETER["longitude_of_center",0],
PARAMETER["azimuth",0],
PARAMETER["pseudo_standard_parallel_1",0],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0],
UNIT["meter",1]]
reprojecting the data - qb is imported QBsubset.TIF file
GRASS6.3.cvs jtskutm/jachym: tmp > r.proj in=qb.4 out=qb.4 location=utm33
and exporting
GRASS6.3.cvs jtskutm/jachym: tmp > r.out.gdal in=qb.4 out=qb4.tif type=Int16 ERROR 6: SetColorTable() only supported for Byte or UInt16 bands in TIFF format. 100% r.out.gdal complete. GRASS6.3.cvs jtskutm/jachym: tmp > gdalinfo qb4.tif Driver: GTiff/GeoTIFF Size is 1987, 1531 Coordinate System is `' Origin = (-464519.016431930009276,-1130918.535061219939962) Pixel Size = (1.000234741781585,-1.000228658536903) Metadata: AREA_OR_POINT=Area Corner Coordinates: Upper Left ( -464519.016,-1130918.535) Lower Left ( -464519.016,-1132449.885) Upper Right ( -462531.550,-1130918.535) Lower Right ( -462531.550,-1132449.885) Center ( -463525.283,-1131684.210) Band 1 Block=1987x2 Type=Int16, ColorInterp=Gray NoData Value=-32768 Metadata: COLOR_TABLE_RULES_COUNT=1 COLOR_TABLE_RULE_RGB_0=2.250000e+02 2.007000e+03 0 0 0 255 255 255
NOTE: the file does not contain datum transformation parameters, but this is realted to bug #1511
3) Final test
=============
qgis qb4.tif QBsubset.TIF
screenshot of this composition is available at http://les-ejk.cz/tmp/krovak-datumshift.png test data area available at http://les-ejk.cz/tmp/QBsubset.TIF

