I re-wrote this post from an original one and need new answers please!

I'm using Qgis 2.18.15 to extract 1' contours from a DEM created from my drone using photogrammetry software.

My main question is how can I reduce the error in calculating these contours?

The steps to do this:

Upload the geotiff DEM CRS ESPG:3857(meters)

Next I re-project the data to the local code EPSG: 32048 which is in feet.

(PROBLEM) The DEM's from the software always come in without any values z values. enter image description here

(SOLUTION) Raster's (properties > styles) set Render Type: Singleband Grey. Set min and max to 0 - 255. Contrast enhancement: Stretch to MinMax enter image description here I'm not sure why but I've changed the values many times and this range always seems to encompass all of the data in the DEM. Is there a reason for these values like some kind of default?

Next I need to re-scale this raster so I find a scale factor between the QGIS DEM and the original data from the software. The min max range specified in the software is 7.41ft to 65.29ft. enter image description here

I set this to have a 0 min so the range becomes 65.29' - 7.41' = range 0 to 57.88. So for a scale factor I take 57.88 / 255 = 0.226980392156. I plug this into the raster calculator and get this:

(PROBLEM) The range of values should be the same as the feet found above (0 to 57.88) but after being scaled it comes in as 0.457592 to 57.8223. enter image description here

The math here using the raster calculator does not make sense.
255 x 0.226980392156 = 57.88 not 57.8223 and 0 x 0.226980392156 = 0 not 0.457592

Continuing with the values I extract 1' contours now that it is scaled

enter image description here

Why does the scale factor math using the raster calculator not make sense? Also, is there a way to explain the min max range 0 to 255 that I've found works well when the DEM comes in without z values?

I need to be as accurate as possible with this data and I know there are multiple places in this process which can skew the data.

  • 2
    What units are your z values in? Also - you might need to re-project the actual layer into ESPG:3857 – firefly-orange Dec 12 '17 at 15:00
  • I nearly solved the problem but I'm still coming up with some problems. Could you please take a look again and give me some advice? Thanks! – Bryan Jan 6 '18 at 0:43

The contour tool always uses the z unit from your CRS, therefore in EPSG:3857 its always meters. Check the values in your raster if they are plausible for meters. If not use the raster calculator to scale and offset it. Also check if the georeference of your raster is correct maybe by adding a basemap. There are a lot of things that can go wrong in photogrammetry which scale your model wrong.

  • Hi I re-edited this post and would like your feedback on the problem I'm having. Thanks for the help! – Bryan Jan 6 '18 at 0:41

It's considered 'bad form' to ask a new question over the top of an old one!

The 0-255 values are the rgb values of the raster. I suspect that the scaled layer is correct as the 57.8223 to 0.457592 scale you are seeing relates to the style of the layer and does not necessarily show the max/min values of the underlying data. You can check the actual max/min by looking at the histogram

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.