I've been trying to work with OSU's Ocean Productivity layers for a while now, but I can't get it open on QGIS. These are "*.hdf" (HDF4) and I've successfully opened and worked with them on ArcGIS in the past using the Marine Geospatial Ecology Tools (MGET), but I haven't had any success with QGIS yet.I don't have access to ArcGIS anymore, so MGET is no longer an option, and I need to find a way to vizualize and work with these on QGIS.
The open button should work for this as it has HDF4 as a file type, but it doesn't. I think it doesnt work because the coordinates are not in a known file type. On ArcGIS, MGET is used to make that conversion, but I do not know how to do it in QGIS.
Can anyone help me with inputting these hdf files into QGIS?
The info available on the FAQ page at OSU is as follows:
These hdf files are in an Equidistant Cylindrical projection.
The rows represent lines of latitude, and the columns coincide with longitude.
For 1080 by 2160 data, the grid spacing is 1/6 of a degree in both latitude and longitude.
1080 rows * 1/6 degree per row = 180 degrees of latitude (+90 to -90).
2160 columns * 1/6 degree per column = 360 degrees of longitude (-180 to +180).
The north west corner of the start of the hdf file is at +90 lat, -180 lon.
To obtain the location of the center of any pixel:
- take the number of rows and columns you are away from the NW corner,
- multiply by the grid spacing to get the change in latitude and longitude,
- subtract the change in latitude from +90 lat,
- add the change in longitude to -180 lon;
- shift the latitude down (subtract) by 1/2 of a grid spacing
- and shift the longitude over (add) by 1/2 of a grid spacing
This gives the center of any pixel. To get the NW corner of any pixel, do not shift over and down by 1/2 of a grid spacing.
Best Answer
It's very easy to load these files in QGIS. I downloaded npp.2006.hdf from this page:
http://orca.science.oregonstate.edu/2160.by.4320.yearly.hdf.land.ocean.merge.php
At QGIS OSGeo Console, the result of:
it is:
where it's very important to know this:
Now, at the QGIS OSGeo Console, I ran the following command:
to get npp.2006.tif file.
When I loaded the GeoTiff raster to QGIS the result was:
where I also loaded the world_borders shapefile (60 % of transparency) to corroborate that the assigned projection with gdal_translate command was correct.
When it was excluded the world_borders shapefile, at the next image, gray areas in npp.2006.tif are corresponding to net primary production (units of mg C / m^2 / day) and black areas to nodata values (-9999).