0

The problem

  • Need to convert a raster .tif tile (DOWNLOAD) from WGS84 to GDA94 Albers;
  • Need to convert its stored pixel info from Float32 to 8 bit UNSIGNED;
  • Need Compression set to "NONE";
  • Need to multiply it by 40; and
  • Need to set its pixel size to 30x30 metres.

My steps

1 - Project the raster tile to GDA94 Albers, stating "30" as Output cell size: ArcMap -> Project raster tool;

2 - Recalculated the pixel values multiplying by 40: QGIS -> Raster calculator (Syntax = "tile_name" * 40);

3 - Convert the pixel depth from Float32 to 8-Unsigned: ArcMap -> copy raster tool.

My results

As you can see from the picture below, I have sampled some points and retrieved the info from the original tile and compared to my output raster: enter image description here

After multiplying by 40, the result I SHOULD expect should be equal to the "OrigX40", however, my results are shown in the "New" column and there's a substantial difference.

In addition, is it normal that after reprojecting the final output it shifts the cells' orientation from tilted (pic above) to non-tilted (pic below)?

enter image description here

enter image description here

This shifted array of cells also contributes to the fact that when I sample a point that is on the fringe between 2 cells of the final output, obviously it does not match with the expected Float value (divided by 40) of the original tile. Is this normal or should the final output maintain a shifted array-like pixel grid, same as the original?

My tools

I have used a combination of QGIS 3.6 Noosa and ArcMap 10 (no Spatial Analyst extension -> no raster calculator!).

My expectations

My expectations are that the final output should align with the original layer and every cell stores the same info the original cells store but times 40.

What am I doing wrong?

  • I take it you don't have a spatial analyst license hence the need for QGIS raster calculator. You might be better to use ArcMap to do both of the first two at the same time: set data frame CRS to GDA94 Albers, add the raster, right click on the layer and select export: CRS same as data frame, check use renderer to scale 32bit to 8bit and output but then use copy raster to change the output pixel type to UInt16 before multiplying by 40 in QGIS. – Michael Stimson Mar 13 at 1:59
  • But are you trying to scale the values??? the input is 1 to 5.55, if you just want to multiply by 40 (40 - 200 range) then 8bit should be enough. The order of INT then Multiply is very important, are you certain you want to truncate the values before multiplication? It looks like you've done it in the reverse order (124 / 40 = 3.1). – Michael Stimson Mar 13 at 2:08
  • @MichaelStimson: I have just swapped my second step with the third. I would like to preserve the float values as much as possible and then multiply by 40. The problem is when I try and fit it into 8 Unsigned and cell size 30x30m that I tend to lose information: cells are bigger (with integer values) compared to the initial float ones and when I sample a final pixel, it encompasses and blends few smaller pixels. Is there a way around this problem? – Overlord84 Mar 13 at 2:15
  • 1
    This will happen with reprojected rasters, the resampling is applied both at the reprojection and at the sampling (if done in Esri; how are you sampling without SA?) If you use the NEAREST resampling method the values will be closer to the original but less accurate. Alternately project your data to WGS84 and sample without resampling for the best results; it's much quicker and more accurate to project vectors than rasters. – Michael Stimson Mar 13 at 2:20
0

Since you use Qgis and don't have Spatial Extension, I recommend you to do everything in QGIS.

I see two possible problems i) Your sampling points are in WGS84 and you don't transform them to Albers. So, the on-fly transformation doesn't work properly (specially if you do it in ArcGIS. ii) You are comparing Float values (original raster) with Int values. Check your values using the "identify features" button in Qgis.

I made the exercise in QGIS following this sequence: 1. Project the original Raster using Wrap. This tool permits to reproject your raster, change the cell size to 30 and the pixel depth from Float to Int (byte).

Selection of Albers/GDA94

enter image description here

you can run it from the Shell using this code:

gdalwarp -ot Byte -s_srs EPSG:4326 -t_srs EPSG:3577 -r near -of GTiff 
-tr 30 30 -co COMPRESS=LZW -co PREDICTOR=1 -wo OPTIMIZE_SIZE=TRUE
WEATHER_INTENSITY_152_-27_intensity.tif "[temporary file]"

Then, I used the Raster Calculator to multiply by 40 as you made. I create those rasters to compare the results:

  • Original WGS84 Float
  • Original_INT WGS84 INT
  • Projected Albers INT
  • Original*40 WGS84 Float
  • Original_INT*40 WGS84 INT
  • Projected*40 Albers INT

Those are the results using the "Identify Feature" button:

As you see, the only difference is between the Float and Int: 1.72*40 ≠ 2*40

  • Thank you Crianopa, however, my first step is projecting everything from WGS84 to GDA94 Albers. The comparison I make is to make sure the original cell multiplied by 40 gives me the desired output.. – Overlord84 Mar 13 at 7:10
  • Sure... My first step was the projection too. Use Wrap tool in Qgis to do it. You will have no problems ;) – crianopa Mar 13 at 11:15
  • What about the shift in cells' orientation (please see original post), do you experience the same thing? If so, is it normal? It throws me an error before obtaining that output, so makes me wonder... – Overlord84 Mar 13 at 22:50
  • It is totally normal. This is because you have two different Coordinate Sytems with different datums and geographic systems. WGS84 (Geographic) and Albers (Projection based on GDA[Geographic]). So, when you display them in a GIS software. the system will recognize one or the other Projection but not both. Then Qgis has something call projection On-The-Fly: docs.qgis.org/2.8/en/docs/user_manual/working_with_projections/… – crianopa Mar 14 at 3:21
0

The issue resided in the fact that I was doing multiple processes in each individual steps. For example when using Warp, I was also specifying output data type, which I was replicating when I was capping the image to a specific point in ArcMap.

I have solved the problem by doing the following steps:

Qgis -> Raster calculator: do the calculations only by leaving projections and cell output as is.

Qgis -> Translate: Converting the data type from Float32 to Byte

ArcMap -> Reproject rster: in this instance I specified the right projection (3577) and the cell size (30x30m)

ArcMap -> Copy Raster: For some reason, the layer got back to Float32 so in the instance of specified a point to anchor the whole raster layer, I've also overridden again the cell data type back to Byte (8 bit unsigned).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.