1

I'm using Agisoft Photoscan 1.4.2 to build DEM from UAV photos and in last versions thay produce DEM multipage tiff format and I want to convert it to tiff with metainformation preserved.

According to this, I use vips to convert multipage tiff to tiff, but it drops all metainformation:

sudo apt-get install libvips-tools
vips im_vips2tiff dem_1_ctb.tif:0 1.tif

Then I wrote python script using GDAL api:

from osgeo import gdal, gdalconst

src = gdal.Open('dem_1_ctb.tif', gdalconst.GA_ReadOnly)
dst = gdal.Open('1.tif', gdalconst.GA_Update)

prj=src.GetProjection()
print('prj:', prj) #

gtr = src.GetGeoTransform()
print('gtr:', gtr) #

dst.SetProjection(prj)
dst.SetGeoTransform(gtr)

Original metainformation obtained by gdalinfo:

Driver: GTiff/GeoTIFF
Files: dem_1_ctb.tif
Size is 1773, 1603
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        TOWGS84[0,0,0,0,0,0,0],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (31.826655569140200,59.242815662671902)
Pixel Size = (0.000002169874100,-0.000001111660512)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  31.8266556,  59.2428157) ( 31d49'35.96"E, 59d14'34.14"N)
Lower Left  (  31.8266556,  59.2410337) ( 31d49'35.96"E, 59d14'27.72"N)
Upper Right (  31.8305028,  59.2428157) ( 31d49'49.81"E, 59d14'34.14"N)
Lower Right (  31.8305028,  59.2410337) ( 31d49'49.81"E, 59d14'27.72"N)
Center      (  31.8285792,  59.2419247) ( 31d49'42.88"E, 59d14'30.93"N)
Band 1 Block=256x256 Type=Float32, ColorInterp=Gray
  NoData Value=0
  Overviews: 887x802, 444x401, 222x201
  Unit Type: metre

Transfered metainformation:

Driver: GTiff/GeoTIFF
Files: 1.tif
Size is 1773, 1603
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (31.826655569140200,59.242815662671902)
Pixel Size = (0.000002169874100,-0.000001111660512)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_RESOLUTIONUNIT=3 (pixels/cm)
  TIFFTAG_XRESOLUTION=10
  TIFFTAG_YRESOLUTION=10
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  31.8266556,  59.2428157) ( 31d49'35.96"E, 59d14'34.14"N)
Lower Left  (  31.8266556,  59.2410337) ( 31d49'35.96"E, 59d14'27.72"N)
Upper Right (  31.8305028,  59.2428157) ( 31d49'49.81"E, 59d14'34.14"N)
Lower Right (  31.8305028,  59.2410337) ( 31d49'49.81"E, 59d14'27.72"N)
Center      (  31.8285792,  59.2419247) ( 31d49'42.88"E, 59d14'30.93"N)
Band 1 Block=1773x16 Type=Float32, ColorInterp=Gray

As I can see some of the metainformation is different, is it harmful? can it be transferred completely?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.