0

I'm calculating Least Cost Path (LCP) within QGIS 2.18. The first step is to produce the slope raster from the DEM. Using r.slope in GRASS produces excellent results where I can go on and finally produce my LCP, whereas using the slope tool within QGIS or GDAL produces something quite different that does NOT allow me to produce my LCP. As a newbie I find this baffling. Can someone explain please? Surely these tools should at least produce something similar?? GRASSGDAL

gdalinfo "E:/BU Volunteer/QGIS/218/gdal-slope.tif"

Driver: GTiff/GeoTIFF Files: E:/BU Volunteer/QGIS/218/gdal-slope.tif Size is 1824, 1416 Coordinate System is: GEOGCS["WGS 84", DATUM["unknown", SPHEROID["WGS84",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]] Origin = (32.899999999999999,15.000000000000000) Pixel Size = (0.008333333000000,-0.008333333000000) Metadata: AREA_OR_POINT=Area Image Structure Metadata: INTERLEAVE=BAND Corner Coordinates: Upper Left ( 32.9000000, 15.0000000) ( 32d54' 0.00"E, 15d 0' 0.00"N) Lower Left ( 32.9000000, 3.2000005) ( 32d54' 0.00"E, 3d12' 0.00"N) Upper Right ( 48.0999994, 15.0000000) ( 48d 6' 0.00"E, 15d 0' 0.00"N) Lower Right ( 48.0999994, 3.2000005) ( 48d 6' 0.00"E, 3d12' 0.00"N) Center ( 40.4999997, 9.1000002) ( 40d30' 0.00"E, 9d 6' 0.00"N) Band 1 Block=1824x1 Type=Float32, ColorInterp=Gray NoData Value=-9999

gdalinfo "E:/BU Volunteer/QGIS/218/grass-slope.tif"

Driver: GTiff/GeoTIFF Files: E:/BU Volunteer/QGIS/218/grass-slope.tif Size is 1824, 1416 Coordinate System is: GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433], AUTHORITY["EPSG","4326"]] Origin = (32.899999999999999,15.000000000000000) Pixel Size = (0.008333332999970,-0.008333333000039) Metadata: AREA_OR_POINT=Area TIFFTAG_SOFTWARE=GRASS GIS 7.4.1 with GDAL 2.2.4 Image Structure Metadata: COMPRESSION=LZW INTERLEAVE=BAND Corner Coordinates: Upper Left ( 32.9000000, 15.0000000) ( 32d54' 0.00"E, 15d 0' 0.00"N) Lower Left ( 32.9000000, 3.2000005) ( 32d54' 0.00"E, 3d12' 0.00"N) Upper Right ( 48.0999994, 15.0000000) ( 48d 6' 0.00"E, 15d 0' 0.00"N) Lower Right ( 48.0999994, 3.2000005) ( 48d 6' 0.00"E, 3d12' 0.00"N) Center ( 40.4999997, 9.1000002) ( 40d30' 0.00"E, 9d 6' 0.00"N) Band 1 Block=1824x1 Type=Float32, ColorInterp=Gray Description = slopeccfd2dd742084285a4245fec4de42bcc NoData Value=nan Metadata: COLOR_TABLE_RULES_COUNT=7 COLOR_TABLE_RULE_RGB_0=0.000000e+000 2.000000e+000 255 255 255 255 255 0 COLOR_TABLE_RULE_RGB_1=2.000000e+000 5.000000e+000 255 255 0 0 255 0 COLOR_TABLE_RULE_RGB_2=5.000000e+000 1.000000e+001 0 255 0 0 255 255 COLOR_TABLE_RULE_RGB_3=1.000000e+001 1.500000e+001 0 255 255 0 0 255 COLOR_TABLE_RULE_RGB_4=1.500000e+001 3.000000e+001 0 0 255 255 0 255 COLOR_TABLE_RULE_RGB_5=3.000000e+001 5.000000e+001 255 0 255 255 0 0 COLOR_TABLE_RULE_RGB_6=5.000000e+001 9.000000e+001 255 0 0 0 0 0

  • What is the problem with creating LCP? That images differ on screen does not prove that they are different. Gdaldem yields a 32 bit image and because the range of slope is only from -90 top 90 degrees you need to use a proper LUT stretch for viewing. Could you add the complete gdaldem command that you have used and check from the image properties of QGIS what sot of styles are applied for showing the raster? – user30184 Dec 19 '18 at 7:19
  • I am a newbie to QGIS and I have no idea what you are asking @user30184. I thought my question was quite clear. The images are totally different and the resultant calculations with the r.cost.points tool in GRASS seem to produce a 'correct' raster and an 'incorrect' raster from the 2 slope rasters above. – IanGS Dec 19 '18 at 8:57
  • Are you saying that the r.slope in GRASS is totally different to the slope tool within QGIS or GDAL ???? All my investigations on how to produce a LCP suggest all slope tools are made equal. If that is not the case, therein lies the hub of my question. How are they different?? So I know when to use one slope tool over another. – IanGS Dec 19 '18 at 9:02
  • I try to say that even if your second picture appears black and white there may be also interim slope values in the image but you just do not see them because of the viewere settings. You do not explain with enough details what you have done and what is the incorrect result that you achieve with the latter raster. GRASS and QGIS/GDAL should give similar results. You can make a comparison about the histograms and other properties of your two images with gdalinfo utility gdalinfo image_name.tif -hist. Add your gdaldem command and gdalinfo reports into your question. – user30184 Dec 19 '18 at 11:25
  • gdalinfo utility - is that the tool in GDAL>Miscellaneous>Information @user30184 ? – IanGS Dec 19 '18 at 12:14

Your Answer

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

Browse other questions tagged or ask your own question.