5

I am trying to find sections of road with steep gradients.

My process is:

  1. pull a linestring from Openstreetmap data
  2. resample it to create a point every 10 metres
  3. look up the height data for each point from ASTER Global Digital Elevation raster
  4. calculate the gradient at 10m intervals and look for any in excess of 14%

This works but throws up a LOT of anomalies which must be due to the height data as I have ridden my bike along these sections. One 10m section on a road segment local to me shows a height difference of 14m between two points 10m apart on the line.

Now clearly this is due to the height data. It is stated to have an accuracy of:

20 meters at 95 % confidence for vertical data and 30 meters at 95 % confidence for horizontal data.

How should I go about smoothing out these anomalies and having a best guess at where the steepest road gradients really are?

Everything has been written in PGPLSQL/POSTGIS so far. I have a set of line strings with points every 10m and a height for each point.

  • 1
    Since you are working with ASTER data that has 30 by 30 meter cells, a 14% gradient might be expected between two points if they span different cells. Are you also getting a lot of 0 meter differences where you expect some slope? – mKurowsKi Dec 4 '14 at 17:59
  • 3
    I'd suggest splitting your roads no finer than the resolution of your elevation data (30m+). The DEM is like a staircase, with a step for each pixel. You've got it set up so there are multiple steps in between stairs. Think how steep a staircase is for a mouse. Spread the steps out (30m+), and the staircase becomes much more manageable. – phloem Dec 4 '14 at 18:24
  • mKurowski - this is exactly what is happening. – user1331131 Dec 4 '14 at 18:42
  • @phloem Your comment kind of contradicts itself (calling for more steps between samples vs reducing samples to the steps), but overall I think you have the right idea and you or mKurowsKi should make that an answer. Essentially the current process is resampling elevation data to a higher resolution with no interpolation. You either have to interpolate (more steps) or not resample ('reduce' samples). – Chris W Dec 4 '14 at 18:47
  • @Chris W - You're right, I mixed up my meaning of steps (points) and stairs (pixels) previously. Basically, don't split the line finer than the DEM resolution, or there will be large jumps between samples. – phloem Dec 4 '14 at 18:53
4

As I messed this up in the comments and cannot edit it now, I'll try again here.

You have two options:

  1. Split your roads no finer than the resolution of your DEM. As it is now, you have multiple samples (10m apart) for a single pixel (30m x 30m). The more samples per pixel, the greater the relative jump between pixels. Take 2 pixels, 30m x 30m, 1m height difference. With one sample in the centre of each pixel, the slope is 1m rise/30m run (0.033 = shallow). Now, split an imaginary line crossing the boundary of the same two pixels, spaced 10m apart: 1m rise/10m run (0.1 = steeper). Decrease spacing to 1m: 1m rise/1m run (1.0: steep). And so on.
  2. Resample your DEM to an artificially fine resolution. This will not save you much work, as now you'll have multiple, similar samples. For example, split the pixels in #1 above into 10m x 10m pixels, and space samples 10m along line. Now you've got three samples, all 0.333 rise/10m run (0.033 = shallow, same as original).
  • In #1 the number of samples doesn't matter - three or thirty per pixel, you'll still get the same jump between the last on one pixel and first on the next. #2 doesn't really solve the problem as we're dealing with an elevation raster as opposed to a slope raster. This is one case where resampling to a higher resolution with some interpolation might be acceptable - attempting to smooth out data. Yes, some values will be artificial, but by actually providing more steps between samples (ie, inserting 9.4 and 9.8 between an 8 and 9) you get a smoother line. – Chris W Dec 4 '14 at 20:32
  • I should add if you put a line from a point at the center of each pixel, you're essentially doing linear interpolation. With the addition of more points, it's no longer linear since you're sampling the same value more than once. Bilinear or Cubic resampling on the DEM raster to a higher resolution might generate false accuracy/data, but it would be a smoother representation. I'll admit to not having a sufficient grasp on statistics to know which would be better, but I know it's been discussed here elsewhere. – Chris W Dec 4 '14 at 21:08
  • I disagree that the number of points doesn't matter. The issue is exactly that large jump between closely spaced samples. The height of the jump is the same, but because the horizontal distance is small, the reported slope is high. With multiple samples per pixel, the resulting slope data looks like: 0, 0, 0, 0, HIGH # (problem), 0, 0... With one sample per pixel, the data should like: moderate, moderate, moderate... – phloem Dec 4 '14 at 21:13
  • 1
    Ah, I understand your logic/phrasing and see what you're getting at, though I'd suggest that where matters as much or more than how many. And something all discussion to this point hasn't mentioned is that the road likely doesn't pass uniformly through pixels, particularly at 30m. – Chris W Dec 4 '14 at 21:38
2

I can't comment so I'll answer with how I would approach this in ArcMap. Perhaps you could make a similar workflow.

Use the extract by mask tool on your DEM with your road lines as the mask. You now have a raster version of the roads with their elevations.

Use the slope tool on that to calculate the slopes along your road raster.

I did a quick try on some stream data and it seems to work.

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.