0

I'm trying to create a VRT file from a GeoTIFF file using the following command:

gdalbuildvrt.exe "C:\Temp\3533.vrt" "C:\Temp\3533.tiff"

However it returns this error:

Warning 6: gdalbuildvrt does not support ungeoreferenced image. Skipping C:\Temp\3533.tiff

I then inspected the file's metadata:

gdalinfo "C:\Temp\3533.tiff"

Which confirmed it was georeferenced:

Driver: GTiff/GeoTIFF
Files: C:\Temp\3533.tiff
Size is 256, 256
GCP Projection =
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["latitude",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["longitude",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
GCP[  0]: Id=1, Info=
          (0,0) -> (130.517578125,-15.7076627695835,0)
GCP[  1]: Id=2, Info=
          (256,0) -> (130.60546875,-15.7076627695835,0)
GCP[  2]: Id=3, Info=
          (256,256) -> (130.60546875,-15.7922535703624,0)
GCP[  3]: Id=4, Info=
          (0,256) -> (130.517578125,-15.7922535703624,0)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  256.0)
Upper Right (  256.0,    0.0)
Lower Right (  256.0,  256.0)
Center      (  128.0,  128.0)
Band 1 Block=256x10 Type=Byte, ColorInterp=Red
Band 2 Block=256x10 Type=Byte, ColorInterp=Green
Band 3 Block=256x10 Type=Byte, ColorInterp=Blue

Is the GeoTIFF missing something that is required by gdalbuildvrt.exe?

2
  • 1
    Yes, it's not georeferenced, note the Corner Coordinates are not map coordinates, they're image/pixel coordinates. You could gdalwarp to vrt using the stored GCPs gdal.org/programs/gdalwarp.html
    – user2856
    Commented Dec 2, 2021 at 3:59
  • GDAL documentation vaguely calls also the GCP method (and RPC) as georeferencing gdal.org/user/raster_data_model.html. What gdalbuildvrt really seems to want is a common affine geotransformation for all images that are used for building a vrt mosaic. Mosaicking is the main usage for gdalbuildvrt.
    – user30184
    Commented Dec 2, 2021 at 7:53

2 Answers 2

2

The message about not georeferenced image is partly misleading. The georeferencing method that gdalbuildvrt support is the affine GeoTransform https://gdal.org/user/raster_data_model.html. Your image is georeferenced with Ground Control Points (GCP).

GDAL datasets have two ways of describing the relationship between raster positions (in pixel/line coordinates) and georeferenced coordinates. The first, and most commonly used is the affine transform (the other is GCPs).

The problem with using GCP georeferencing with gdalbuildvrt is probably that each image in the VRT mosaic would need to be handled with different parameters, computed by the corresponding ground control points. If you want to convert just one image into VRT use gdal_translate instead

gdal_translate -of VRT buildvrt.exe "C:\Temp\3533.tiff" "C:\Temp\3533.vrt"

If you need to build a VRT mosaic from many images which are georeferenced with GCPs you must first convert them so that they use the affine geotransformation. That can be done with gdalwarp

gdalwarp -of GTiff "C:\Temp\3533.tiff" "C:\Temp\3533Affine.tiff"

Gdalbuildvrt will work with 3533Affine.tiff.

0

To give the GeoTIFF file proper georeference data, use the -a_ullr argument.

gdal_translate.exe -of GTiff -a_ullr {upper_left_longitude} {upper_left_latitude} {lower_right_longitude} {lower_right_latitude} "C:\Temp\3533.jpg" "C:\Temp\3533.tiff"

Then inspect the file's metadata:

gdalinfo "C:\Temp\3533.tiff"

It shows that the Corner Coordinates value is populated:

Driver: GTiff/GeoTIFF
Files: C:\Temp\3533.tiff
Size is 256, 256
Origin = (130.517578125000000,-15.707662769583502)
Pixel Size = (0.000343322753906,-0.000330432815543)
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  ( 130.5175781, -15.7076628)
Lower Left  ( 130.5175781, -15.7922536)
Upper Right ( 130.6054688, -15.7076628)
Lower Right ( 130.6054688, -15.7922536)
Center      ( 130.5615234, -15.7499582)
Band 1 Block=256x10 Type=Byte, ColorInterp=Red
Band 2 Block=256x10 Type=Byte, ColorInterp=Green
Band 3 Block=256x10 Type=Byte, ColorInterp=Blue
1
  • 2
    That method does create a file that will be accepted by gdalbuildvrt, but in this case all the information that is needed is already in the GCPs of the source image and gdalwarp input.tif output.tifwill create a North-up image with affine geotransformation. No need to feed coordinates manually.
    – user30184
    Commented Dec 2, 2021 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.