qgis / QGIS-Documentation

QGIS Documentation
https://docs.qgis.org/latest
471 stars 695 forks source link

QGIS Tutorial Lesson 7.3.1 version 3.34. #9069

Closed lauriefitzherbert closed 5 months ago

lauriefitzherbert commented 5 months ago

Tutorial Clarification QGIS Tutorial Lesson 7.3.1 version 3.34.

Raster Terrain Analysis module "Hillshade" produces a blank layer when the SAVE FILE AS... option that appears in the Hillshade dialog screen is used.

But, the Hillshade module outputs a correct tif file layer when the above "SAVE FILE AS... " option is NOT USED.

PS While taking time to write a "bug" I inadvertently discovered how the error occurs. (see Steps). I'm a little embarrassed to post but if the steps were outlined in the tutorial to avoid this issue, it might help another new QGIS user.

Steps to reproduce the issue

STEPS TO PRODUCE Blank Hillshade Layer:

  1. In New Project, Layer->Add Layer->Add Raster layer-> Select File... ( ie. /.. /raster/SRTM/srtm_41_19 obtained from QGIS Training Data Master zip )

  2. Under Processing Toolbox->Raster terrain analysis->Hillshade (Settings used : Z factor 1.0, Azimuth 300.0°, Vertical angle 40.0°; )

  3. Right click on Hillshade text box, Select-> Save File As.... choose /directory/hillshade (or anyname or anyname.vrt)

  4. Select ->Run.

  5. Close dialog. RESULT: New Hillshade layer appears layer menu (as top layer) but layer is BLANK.
    Turning other layer off made no difference. Turning Hillshade layer on and off did nothing. Screen remained white.

STEPS THAT PRODUCED CORRECT HILLSHADE LAYER Follow steps 1 & 2 above. Skip 3- DO NOT USE "Save File As", Leave Blank. Select Run and Close dialog matches appearance of QGIS Tutorial Lesson 7.3.1 version 3.34.

Versions

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

QGIS version | 3.36.1-Maidenhead | QGIS code revision | 3e589453264 -- | -- | -- | -- Qt version | 5.15.8 Python version | 3.11.2 GDAL/OGR version | 3.6.2 PROJ version | 9.1.1 EPSG Registry database version | v10.076 (2022-08-31) GEOS version | 3.11.1-CAPI-1.17.1 SQLite version | 3.40.1 PostgreSQL client version | 15.5 (Debian 15.5-0+deb12u1) SpatiaLite version | 5.0.1 QWT version | 6.1.4 QScintilla2 version | 2.13.3 OS version | Debian GNU/Linux 12 (bookworm)   |   |   |   Active Python plugins valuetool | 3.0.19 grassprovider | 2.12.99 MetaSearch | 0.3.6 processing | 2.12.99 db_manager | 0.1.20 QGIS version ### Supported QGIS version - [X] I'm running a supported QGIS version according to [the roadmap](https://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule). ### New profile - [ ] I tried with a new [QGIS profile](https://docs.qgis.org/latest/en/docs/user_manual/introduction/qgis_configuration.html#working-with-user-profiles) ### Additional context ###Issue with Tutorial NOTE: Following the QGIS Training Manual 3.34, chapt 7.3. But I'd saved the file using the hillshade dialog. I did not know that the SAVE AS FILE, set to type "vrt". was wrong, nor did I have info on the file format required by the hillshade algorithm. Later, only after using export on an unsaved correctly displayed hillshade layer produced, that saved in tif format did I begin to investigate if there where the hillside algorithm saved the tif file that I finally figured out it didn't and that for some reason the default under SAVE FILE AS had been set to *.vrt. Unfamiliar with 'vrt' my assumption was this must be a QGIS file type and I only discovered that it wasn't an image by directly reading the file in another text editor. As far as a reporting a "bug" - It's more a question- as to why would one want a vrt file output be an option to the hillshade dialog if it does not generate a tiff file for the vrt to point to? Is vrt even an file format that qualifies as a working file file format option for the hillshade algorithm? I am new a new user and do realize that there's advanced features that might utilize other file formats. So, if that is the case, it comes back to the tutorial. (It's been a long time, but I used to write software manuals back in the day for mapping company. The instructions in the tutorial are mostly quite clear, so when I couldn't get the layer to generate, I went back to the near beginning of the tutorial hoping to find some step I'd not done correctly. I was quite close to giving up on my quest to learn QGIS. ) I managed to get to chapter 8 but as you will see, in a different post, found another issue.
selmaVH1 commented 5 months ago

Hi @lauriefitzherbert first of all thank you for using QGIS and its manuals.

As far as I understand (correct if I made wrong assumption), while following the training manual (lesson 7.1.2), you chose to save the Virtual Raster as a VRT file. QGIS remembered this setting and offered it to you within the Hillshade dialog under the SAVE AS FILE option (as the last format you used). In this case, you need to manually select the format that suits you, in this case, TIF. If Hillshade was the first raster-related process you performed in your project, then TIF would be automatically suggested as the format. When you don't specify a file to save to (you don't use the "SAVE FILE AS..." or "SAVE TO FILE..." option), QGIS automatically creates a temporary TIF file to store the raster data from the Hillshade operation. That's why you're able to see the hillshade correctly in this case. To resolve the issue, you should save the output of the Hillshade operation as a TIF file instead of a VRT file. You can do this by specifying a file name with a .tif extension in the "SAVE FILE AS..." option in the Hillshade dialog.

The VRT file output option is available in the hillshade dialog because VRT, or Virtual Raster, is a format that QGIS can use to handle raster data. A VRT file is a form of metadata that describes an underlying raster image, which can be in another format like TIF. You can find explanation for VRT in the first lesson, that I already mentioned: "Now as you can see from this, your solution layer lies across all four images. What this means is that you are going to have to work with four rasters all the time. That’s not ideal. It would be better to have one file to work with. Luckily, QGIS allows you to do exactly this, and without needing to actually create a new raster file. You can create a Virtual Raster. This is also often called a Catalog, which explains its function. It’s not really a new raster. Rather, it is a way to organize your existing rasters into one catalog: one file for easy access." In summary, VRT is indeed a valid file format option for the hillshade algorithm, but it's used differently than formats like TIF that contain actual raster data.

I hope this helps.

DelazJ commented 5 months ago

Hi @lauriefitzherbert

9077 now makes the file format explicit for the algorithms outputs and will close this report.

As far as a reporting a "bug" - It's more a question- as to why would one want a vrt file output be an option to the hillshade dialog if it does not generate a tiff file for the vrt to point to? Is vrt even an file format that qualifies as a working file file format option for the hillshade algorithm?

I think these are good questions and will let developers/more skilled people reply to these (or fix) in the other report you opened at qgis/QGIS#57247

lauriefitzherbert commented 5 months ago

Thank you both for your help and thank everyone for the Training Manual & QGIS.

Sometimes I can be too much of a stickler with instructions. But this time it took me a while to figure out. Lesson 7.1 did not specify what type of file I was creating. So, I just left what I thought the default was having forgotten it got changed in Lesson 1. It is rare that I don't append a file format extension to a typed file name.

@selmaVH1 thank you for the explanation of the VRT. I must have missed it in the 1st lesson but maybe that was how I did change the file format. VRT's and me are going to get along, very cool idea!

@DelazJ Thank you for considering forwarding my questions.

I have another issue that might be a bug found via Training Lesson 12. In excruciatingly painful detail, it was posted under Documentation rather than a Bug and since I'm new, I refrained from from making or suggesting any edits to the Training manual page via a link in that manual.

PS It's been along time since I worked in mapping or studied SIE. My! How things have changed! QGIS is light years faster and way ahead of the expensive software I used back in the day. There's so many advances. But, the fundamentals remain!

I used to use modules from C-something (C-RASC? I rasC?) in Microstation warp aerial images taken by aircraft in that program as well as align /create vector files. Then I'd write & run batch files to test & find errors. To form DEM, I used Autocad (Rev 14) LOL because it worked better /faster than Microstation. Then I used Microsoft Access for the DB & SQL that could be linked to either, given the correct file format export. When all was said & done it got complied, translated and moved into that pay-per-view software I won't name & sold to a client (who had to own a copy of that pay-per-view software or use a free very stunted "View" version that limited their comprehension of what could be done with their map-GIS foundation. Since then, I gave up on mapping, moved to engineering CAD and then out of the entire profession & away from computers.

I just returned to work out an old thesis project I'd had in mind 30 yrs ago that unfortunately I wasn't able to complete. Step one was to locate a free GiS program. I honestly was not expecting much at my price!

But, I could not believe my eyes when I found QGIS!!! Such a NICE NICE NICE GUI! Great Quality! It has every feature I could have never have dreamed of all those years ago ! And all the tedious work has been automated and incorporated! It is truly a wonderful project and all I can say is what a smart, talented group, the QGIS Team is!

My Senior Thesis (age implied) will be dedicated to all of you.