Skip to main content
Question

Calculate slope along lines

  • November 23, 2017
  • 9 replies
  • 508 views

ireen
Contributor
Forum|alt.badge.img+5

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?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

9 replies

jdh
Contributor
Forum|alt.badge.img+41
  • Contributor
  • November 23, 2017

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.

Β 

Β 


ireen
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • November 24, 2017

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.

Β 

Β 


takashi
Celebrity
  • November 24, 2017

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.


redgeographics
VIP
Forum|alt.badge.img+63

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!)Β 

Β 

Β 


ireen
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • December 14, 2017

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?

Β 


takashi
Celebrity
  • December 15, 2017

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)

Β 

Β 


ireen
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • December 18, 2017
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!

Β 

Β 


takashi
Celebrity
  • December 18, 2017

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.

Β 


ireen
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • December 18, 2017
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.

Β 

Β