[Qgis-user] Qgis-user Digest, Vol 171, Issue 4

Thayer Young thayeray at yahoo.com
Sat May 2 08:30:16 PDT 2020


 Hi Kimberly,
  You may want to try using GDAL to convert the file to a different format before opening it into QGIS. You can try it from the command line, or from within QGIS using Raster: Conversion: Translate (Convert Format).  Note that the QGIS tool lists the GDAL command that it uses, so if you start there you at least can use the GUI to get the file names, etc. right, before moving to the command line to tinker.  It may not work as GDAL is likely what QGIS is using to open the file, but maybe Q is set up with GDAL switches that won't open the file correctly.   To check if GDAL can at least read your file you may want to start from the command line using Terminal (after you type in gdalinfo you should be able to drag and drop your file into the Terminal, and it will fill in the file path): 
gdalinfo path/to/your_file.hdf
If it complains that: "-bash: gdalinfo: command not found"  you will have to track down where your gdal binaries are installed. One place to look is inside of QGIS.app: so in Finder go to Applications and right click on QGIS.app and Show Package Contents, then navigate through the folders: /Contents/MacOS/bin, you can drag and drop the gdalinfo or any of the other binaries into terminal, to get the path and then write your command after that:
 /Applications/QGIS3.12.app/Contents/MacOS/bin/gdalinfo path/to/your_file.hdf
 /Applications/QGIS3.12.app/Contents/MacOS/bin/gdal_translate [paste command here]

If you get tired of doing all that you can do a web search for how to make an alias in your .bash_profile.
See this GIS Stack Exchange answer, about using GDAL to convert a single band at a time from hdf to tif:https://gis.stackexchange.com/questions/220281/how-to-use-gdal-to-convert-hdf-multi-band-file-to-a-single-geotiff-file#220291

-Thayer


================================================
Message: 1
Date: Fri, 1 May 2020 20:38:39 -0500
From: KIMBERLY CRISTINA NAVARRO VELEZ
    <kimberly.navarro at correounivalle.edu.co>
To: qgis-user at lists.osgeo.org
Subject: [Qgis-user] Error at opening .hdf MODIS layer in QGIS 3.12
Message-ID:
    <A4327FEE-7C2C-4BF9-881D-80DF63CC2213 at correounivalle.edu.co>
Content-Type: text/plain; charset="utf-8"

Hello,

I am new using QGIS. I´ve been trying to open a raster layer downloaded from USGS Earth explorer. The file have an .hdf extension. It open in other computers in different QGIS versions, but it does not in my computer, neither in two of my friends computers.

I am using QGIS 3.12, But I also tried QGIS 3.10.

I need to be able to open the file so I can extract some data from it.

I tried using the Python console, following some advices from youtube and GitHub, but it did not work.
I also try to open the layer by using the function Clip Raster from Mask Layer. It also, did not work.

Every time I tried a red flag happened and this phrase appears: Invalid Layer: Raster Layer Provider is not valid (provider: gdal, URI:users/download/MYD11A2.A2012.12313.123.hdf) (I am adding a screenshot)

I have a MacBook Pro 2017, my IOS version is Mojave 10.14.6

I installed the program from your webpage, MacOs version.

I would really appreciate your help…. I have look everywhere and Can’t find a solution.

Thanks, Kimberly.

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200502/64809969/attachment.html>


More information about the Qgis-user mailing list