1

I am in an early stage of least cost paths analysis of a wide area. One part of the operation includes simulation of movement across the grid of previously agreed size of cells and extent of the grid (for reference one cell is 5X5 km).

I have easily enough created the grid (as vector - polygon file), however i would now need to provide friction values as a attribute input for each cell (each cell is a separate polygon entry), based on the above the sea level values from an underlying DEM model (SRTM in this case). In short this would, ideally, look like this: - if a 5X5km cell contains more than 50% of surface that is of certain above-the-sea level, i would attribute a value to it from a devised chart of values that describe the friction value for this cell.

Can someone suggest how to proceed with this?

I am quite uncertain how to satisfy the "above 50%" condition. While i expect to be working with raster data, majority of work will be done while working in table format, with values extracted from various cost raster.

0

You could do this by using gdalwarp and set the resampling method to median. you don't need your 5km by 5km vector layer. Just resample the original raster to the resolution desired (enter this in the dialog box). You will probably keep your input and output CRS the same for this use-case.

We are using median and not mean to try and reduce the effect of a small but very high patch of ground that would otherwise skew the whole area to appear to be above sea level. Once you have a raster of all the median heights, you then will need to reclassify it with your cost values.

0

You can use the raster calculator to reclassify the DEM according to these rules:

  • 0 if the cell is below sea level
  • 1 if the cell is above sea level

Use this formula:

@myraster*(@myraster > sealevel)

Substitute the actual sea level elevation value where it says sealevel, and substitute the name of your raster where it says myraster.

This gives you a raster where 0 is sea and 1 is land.

Then you can either:

  • Use gdalwarp (as MappaGnosis suggested) to resample to 5km x 5km cells, but calculate the mean. Polygonize and use the resulting grid in your analysis.

-or-

  • Use the Zonal Stats tool to add the mean raster value to each grid square, using your grid file as the "Vector layer containing zones."

Multiply by 100 to convert to percentage. Eg, grid cells with a value of 0.5 have 50% land above sea level.

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.