Question

Calculate slope along lines

  • 23 November 2017
  • 9 replies
  • 29 views

Badge

Hello,

I want to make a FME model in which the slope along bicycle routes is determined, as well as the direction of the slope (uphill/downhill).

My idea:

- dividing the network in small parts of +/- 50 metres long (LineDivider)

- define the elevation of the start- and endpoint of the lines, as well as the direction

- calculate the slope in between these points + direction

Anyone who can help me with this?


9 replies

Badge +22

What about getting a DEM and running it through a RasterSlopeCalculator and a RasterAspectCalculator, then breaking your lines into points (presumably densified first) and using a PointOnRasterValueExtractor.

 

 

Badge

What about getting a DEM and running it through a RasterSlopeCalculator and a RasterAspectCalculator, then breaking your lines into points (presumably densified first) and using a PointOnRasterValueExtractor.

 

 

The issue is that the result should be presented on a cycling map, showing the slope and slope direction on the route segments. When I break the lines into points and get values by the PointOnRasterValueExtractor, I will get punctual information that's possibly not representative for the whole route section.

 

 

Userlevel 2
Badge +17

Hi @ireen, if you have a surface model (DEM raster, point cloud, set of 3D points etc.) covering the area, you can drape the lines with the SurfaceDraper (Drape Method: VERTEX). You can then calculate the slope of a line from z-coordinates of start/end nodes and length.

Userlevel 4
Badge +25

Hi @ireen, if you have a surface model (DEM raster, point cloud, set of 3D points etc.) covering the area, you can drape the lines with the SurfaceDraper (Drape Method: VERTEX). You can then calculate the slope of a line from z-coordinates of start/end nodes and length.

That's what I did for a cycling map.

 

 

((@Value(_zmax)-@Value(_zmin))/@Value(_length))*100 
Gives you a slope percentage (10m of rise over 100m horizontal is a 10% slope). This was not for a route, so instead of _zmax and _zmin (from a BoundsExtractor) use the first and last z-values, a negative slope means you're going downhill (whee!) 

 

 

Badge

Hi @ireen, if you have a surface model (DEM raster, point cloud, set of 3D points etc.) covering the area, you can drape the lines with the SurfaceDraper (Drape Method: VERTEX). You can then calculate the slope of a line from z-coordinates of start/end nodes and length.

Hi Takashi, I'm still struggling with the surface draper. I get an error saying that Rasters with multiple bands are unsupported, but my reader contains a raster with only 1 band. Nevertheless, I tried the Raster band separator transformer, but this results in the same raster and the same error ("SurfaceDraper(SurfaceModelFactory): Rasters with multiple bands are unsupported."). Any idea what I'm doing wrong?

 

Userlevel 2
Badge +17

Hi @ireen, if you have a surface model (DEM raster, point cloud, set of 3D points etc.) covering the area, you can drape the lines with the SurfaceDraper (Drape Method: VERTEX). You can then calculate the slope of a line from z-coordinates of start/end nodes and length.

The SurfaceDraper should not raise the error "Rasters with multiple bands are unsupported" if the input raster has just a single band without palette, but it raise another error "Palettes are not supported by this factory" if the single band raster has a palette.

 

Firstly send the raster to an Inspector to check the data structure with Feature Information window in FME Data Inspector.

 

 

Example 1: DEM Raster (Single Band Numeric Raster)

 

 

Example 2: RGB Color Image (Three Bands Image Raster)

 

 

Badge
The SurfaceDraper should not raise the error "Rasters with multiple bands are unsupported" if the input raster has just a single band without palette, but it raise another error "Palettes are not supported by this factory" if the single band raster has a palette.

 

Firstly send the raster to an Inspector to check the data structure with Feature Information window in FME Data Inspector.

 

 

Example 1: DEM Raster (Single Band Numeric Raster)

 

 

Example 2: RGB Color Image (Three Bands Image Raster)

 

 

Hi Takashi,

 

The inspector indeed shows there are 2 bands ... The rasterbandsplitter does not result in 2 rasters, but also 1 (the same). Is there another way to remove the ALPHA8-band?

 

Thanks a lot for your help!

 

 

Userlevel 2
Badge +17

Hi @ireen, if you have a surface model (DEM raster, point cloud, set of 3D points etc.) covering the area, you can drape the lines with the SurfaceDraper (Drape Method: VERTEX). You can then calculate the slope of a line from z-coordinates of start/end nodes and length.

The RasterBandSeparator should separate a raster with multiple bands into multiple rasters with single band. I think it's a case that should be investigated by Safe support.

 

As a workaround in the interim, the RasterSelector and the RasterBandRemover (or Keeper) should work as well. Try this.

 

Badge
The RasterBandSeparator should separate a raster with multiple bands into multiple rasters with single band. I think it's a case that should be investigated by Safe support.

 

As a workaround in the interim, the RasterSelector and the RasterBandRemover (or Keeper) should work as well. Try this.

 

OK, I'll try it this way.

 

 

Reply