Important: Please read the Qt Code of Conduct -

[SOLVED]Read and display geotiff images.

  • Is it possible to display a GeoTiff image in Qt?
    I would prefer not having to use OpenCV though, so if any of you had any idea on how this is done I would appreciate any examples or some other recourse to get me started.

  • Lifetime Qt Champion


    Are you interested in reading only the image or also the metadata ?

  • Hi SGaist,

    I would actually be interested in having the metadata too, because I want to calculate the total distance of the image (in meters).
    But if that is not possible to do then just the image should be fine.

  • Lifetime Qt Champion

    Unless I'm mistaken (please correct me if I'm wrong) but GeoTiff uses tiff, which is already supported by Qt however I don't think you can access the meta data directly maybe using QImageReader::textKeys() and friends.

  • I will try that and report back. The textKeys, suggestion I mean.

  • @SGaist I tried using textKeys but unfortunately they report nothing back when I try to search about available text keys.

    What I do get though are warnings of the type

    TIFFReadDirectory: Warning, Unknown field with tag 33550 (0x830e) encountered.
    TIFFReadDirectory: Warning, Unknown field with tag 33922 (0x8482) encountered.
    TIFFReadDirectory: Warning, Unknown field with tag 34735 (0x87af) encountered.
    TIFFReadDirectory: Warning, Unknown field with tag 34736 (0x87b0) encountered.

    That are actually tags but there seems to be no method of reading them.

  • Lifetime Qt Champion

    That's what I feared. You could open a feature request on the bug report system and use a library like GDAL in-between to get the tags.

  • Indeed I should.
    Seems like geotiflib is a good solution. Actually reading the tags should be actually pretty easy. I mean that it can be achieved with minimal changes to the existing tiff parser, so hopefully this wont be an issue on future releases.

  • Issue opened here.

  • Lifetime Qt Champion

    If you need to do it for your project anyway, you could improve the tiff parser from Qt :)

  • Yeah as I said above, I had a quick look and I believe it can be done relatively with ease. I will definitely give it a try as soon as I find some time :)

Log in to reply