Friday, 5 October 2018

qgis - Slope analysis from NED data gives crazy histogram?




I'm attempting a simple slope analysis in QGIS2 using the plugin at Raster -> Terrain Analysis -> Slope. The slope output layer has a very strange histogram, basically spikes at 0 and at 89.9098 with one big valley in the middle:


enter image description here


Here's the initial DEM:


enter image description here


And the resulting slope layer (note that Contrast Enhancement is already at 'stretch to minmax'):


enter image description here


The place I got the DEM is the NED. I tried the gridfloat format, and the arcgrid format, and the IMG format. I downloaded from nationalmap and also from atlas.ca.gov - all seem to have the same resulting histogram.


The procedure I used to make the slope layer was Raster -> Terrain Analysis -> Slope, GeoTIFF, Z factor = 1.0 (what does that do anyway?)


Seems like simple pilot error; however: I found this tutorial online (for QGIS 1.something) that comes with a sample DEM, and it worked just fine using the same procedure. So, it's not a fundamental QGIS2 bug.



So, it must be slightly more complex pilot error: there must be a conversion step or something I'm missing?



Answer



Interesting. I just did the same thing, with the same results. It turns out that QGIS assumes that the vertical units are the same as the CRS units.


My test image was unprojected Lat/Lon and I'm assuming yours is too? I reprojected the image to UTM (so units would be meters) and the slope calculation worked just fine.


To try this yourself, right-click on your DEM, go to Save As, and under CRS, set it to a meters-based projection (UTM should work fine.) Then try the slope calculation on your newly saved DEM.


EDIT: This will obviously only work if your data is actually in meters. If it's feet, choose a projection with feet as units.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...