Display GeoTiff or .asc Rasters in Qt



  • Hi there!
    I'm building a GUI for a small C-Script which simulates avalanches and debris flows. The embedding of the scripts works fine and everything is as it's supposed to be, input rasters are being used for the calculations, output rasters are converted to geotiff via GDAL.

    Now I would like to select each GeoTiff and display it in the GUI and use basic functions like zoom in/out and identify/analyze a pixel when i click on it (each GeoTiff layer saves different values, like velocity, max. output etc). I tried searching everywhere and I stumble across the same posts over and over again.

    https://forum.qt.io/topic/58198/solved-read-and-display-geotiff-images/2 even marked as solved, but the info is no good
    http://stackoverflow.com/questions/31566544/display-geotiff-images-with-qt also no good

    All I need is to display a GeoTiff or the unconverted .asc Raster (AAIGrid) in the GUI and zoom in/out and select a pixel and read its value, how can that be so hard? :/

    Best regards and thanks for any pointers,
    M


  • Lifetime Qt Champion

    Hi,

    Doesn't the OpenCV suggestion match your needs ?



  • Hi!
    Sorry for the delay - after a long struggle I managed to get opencv compiled with MinGW, working with Qt and now the imageviewer actually works :D

    FYI: That's all that was needed in the end:

    cv::Mat img = cv::imread("image.tif");
    namedWindow("Windowname", WINDOW_NORMAL);
    cv::imshow("Windowname", img);
    

    Next step is reading out the pixel-data, I might get back on that part if I can't manage.

    Thanks


  • Lifetime Qt Champion

    Do you mean convert a cv::Mat into a QImage ?



  • Well no, in ArcGIS/QGIS and the likes you can "identify" a point by clicking on it and get the id/attributes and the value of that raster-layer. The I don't want the RGB data, I need the stored value of that GeoTiff raster (values are altitude, speed, volume, etc).
    Best regards


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.