Skip to contents

The slope_z*() functions calculate summary values for the Z axis in sfc objects with XYZ geometries.

Usage

z_value(x)

z_start(x)

z_end(x)

z_mean(x)

z_max(x)

z_min(x)

z_elevation_change_start_end(x)

z_direction(x)

z_cumulative_difference(x)

Arguments

x

An sfc object with 'XYZ' coordinates

Value

A vector of values representing elevations associated with simple feature geometries that have elevations (XYZ coordinates).

Examples

x = slopes::lisbon_route_3d
x
#> Simple feature collection with 1 feature and 3 fields
#> Geometry type: LINESTRING
#> Dimension:     XYZ
#> Bounding box:  xmin: -88214.27 ymin: -106127.1 xmax: -86881.07 ymax: -105506.3
#> z_range:       zmin: 6.650858 zmax: 94.99939
#> Projected CRS: ETRS89 / Portugal TM06
#> # A tibble: 1 × 4
#>                                              geometry    ID sum_length pathfound
#> *                                    <LINESTRING [m]> <dbl>      <dbl> <lgl>    
#> 1 Z (-88202.31 -105757.6 55.91552, -88201.67 -105762…     1      2519. TRUE     
z_value(x)[1:5]
#> [1] 55.91552 55.52176 54.62495 50.82914 50.76749
xy = slopes::lisbon_route
try(z_value(xy)) # error message
#> Error in z_value(xy) : 
#>   Requires object that have XYZ geometries, see ?slope_raster.
z_start(x)
#> [1] 55.91552
z_end(x)
#> [1] 94.28048
z_direction(x)
#> [1] 1
z_elevation_change_start_end(x)
#> [1] 38.36497
z_direction(x)
#> [1] 1
z_cumulative_difference(x)
#> [1] 196.9088