Skip to contents

Retrieves elevation data for a specified geographic area using the elevatr package. The data is returned as a raster object that can be used with the plotting functions in this package.

Usage

get_elevation(bb = NULL, z = 9)

Arguments

bb

A bounding box object (sf::bbox) or NULL to use the last drawn bounding box

z

Zoom level for elevation data (1-14, higher means more detail). Default is 9, which provides a good balance between detail and download size.

Value

A raster object containing elevation data

Examples

# Using the included Wilder Kaiser bounding box
elevation <- get_elevation(bb_wilder_kaiser)
#> Error in loadNamespace(x): there is no package called ‘progress’
plot_elevation()
#> Error in plot_elevation(): No elevation data available. Please run get_elevation() first.

# Using a higher zoom level for more detail
detailed_elevation <- get_elevation(bb_wilder_kaiser, z = 12)
#> Error in loadNamespace(x): there is no package called ‘progress’
plot_elevation()
#> Error in plot_elevation(): No elevation data available. Please run get_elevation() first.