The reprojection of a raster containing slope data from CRS:4326 to CRS:25830 resulted in a change in raster values. When I add the reprojected raster over the original one and use the identify features tool I can see that in some locations the values went from 0.25 to 3.
-
It would be much easier to say something if there was a small test dataset. But warping leads to rotation, scaling etc. and therefore the original pixels are almost always resampled into the target. The default resampling algorithm is "nearest neighbor" and it should not create new values but pick an existing one. If in the original any of the adjacent pixels has value 3 I think what you see is normal, the nearest pixel in the warped domain just was not the one that you thought. Resampling methods like average or cubic are almost guaranteed to change the pixel values.– user30184Commented Jun 22, 2022 at 10:13
-
Thank you for elaborating on this, but I really do not understand what happens. I downloaded a slope map from the spanish government in ASC format, the only thing I did then is assign the missing CRS (UTM 30N). When I export the slope map without changing anything to a gtiff and open both files they match up perfectly. Also the range of values is exactly the same, but when I inspect the map with identify features tool, the values are totally different?– N_LLCCommented Jun 22, 2022 at 10:22
-
How did you "assign the missing CRS"? You wrote "eprojection of a raster containing slope data from CRS:4326 to CRS:25830" so did you warp (pixels get reprojected) or did you assign 25830 into 4326 source data (pixels are not reprojected but the data has now wrong CRS metadata? Edit your question so that others can know what you did and do the same without asking more questions for clarification.– user30184Commented Jun 22, 2022 at 10:29
-
I did the reprojection with warp (reproject). Then with the identify features tool they did not match up. Something else I tried is, assign crs and then export and they still do not have matching values.– N_LLCCommented Jun 22, 2022 at 11:11
-
Warping is generally not reversible process at pixel level. In your example you (logically) warp once 4326->25830 and then 25830->4326. Even with NN resampling the result may well be the value of some pixel that is a neighbor of the original.– user30184Commented Jun 22, 2022 at 11:19
1 Answer
I was having what I believe may be your issue with a USGS DEM because I failed to set the "Source CRS [optional]" in the QGIS Warp (Reproject) form. I was getting values (elevations) about 7% lower than they should have been.
I needed to set the source CRS to the original DEM projection (EPSG:26912 - NAD83 / UTM zone 12N). I described my problem and this solution in this question: Reprojecting (warp) raster changed the values of the reprojected raster QGIS
This could be your answer.