| Title: | Download Elevation Data For Anywhere In The World And Visualize It |
|---|---|
| Description: | The ridges package allows downloading topographical elevation data and visualizing it using various plots. Elevation data can be visualized as ridgeline plots and topographical heat maps. |
| Authors: | Jan Simson [aut, cre] |
| Maintainer: | Jan Simson <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.0.9000 |
| Built: | 2026-06-01 07:20:08 UTC |
| Source: | https://github.com/jansim/ridges |
A dataset containing the bounding box coordinates of the Wilder Kaiser mountain range.
bb_wilder_kaiserbb_wilder_kaiser
A numeric vector with 4 elements:
Minimum longitude
Minimum latitude
Maximum longitude
Maximum latitude
OpenStreetMap data
Takes elevation data and calculates the data needed for plotting ridgelines by sampling the elevation at regular y-intervals. You will only need this function if you want to create your own custom plots from the ground up.
calculate_ridgelines(elevation = NULL, n_lines = 30)calculate_ridgelines(elevation = NULL, n_lines = 30)
elevation |
A raster object containing elevation data, or NULL to use last elevation |
n_lines |
Number of ridgelines to calculate |
A data frame containing the ridgeline data with columns x, y, elevation, and group
Opens an interactive map interface in your web browser where you can draw a rectangular bounding box to select an area of interest. Use the rectangle tool in the top-right corner to draw the box, then click 'Submit' to return the selection.
draw_bb(start_place_name = NULL, terrain = TRUE, provider = NULL)draw_bb(start_place_name = NULL, terrain = TRUE, provider = NULL)
start_place_name |
Optional address or place name to initially center the map on. This helps you quickly navigate to your area of interest. |
terrain |
Logical, whether to use OpenTopoMap tiles (default: TRUE) |
provider |
Optional custom tile provider. If specified, overrides the terrain parameter. See leaflet::providers for available providers. |
A bounding box object (sf::bbox) that can be used with get_elevation()
## Not run: # Open map centered on default location bb <- draw_bb() # Open map centered on a specific location bb_innsbruck <- draw_bb("Innsbruck, Austria") # Use the returned bounding box to get elevation data elevation <- get_elevation(bb_innsbruck) ## End(Not run) ### Not run: # Open map centered on default location bb <- draw_bb() # Open map centered on a specific location bb_innsbruck <- draw_bb("Innsbruck, Austria") # Use the returned bounding box to get elevation data elevation <- get_elevation(bb_innsbruck) ## End(Not run) #
A dataset containing elevation data for the Wilder Kaiser mountain range.
ele_wilder_kaiserele_wilder_kaiser
A raster object containing elevation data
SRTM elevation data
Creates separate SVG files for each ridgeline slice, maintaining the same scaling and proportions as plot_ridgelines().
export_ridgeline_svgs( elevation = NULL, output_dir = "export", n_lines = 30, scale_factor = 10, line_color = "black", fill_color = NULL, linewidth = 0.5, width = 800, height = 200, closed = TRUE )export_ridgeline_svgs( elevation = NULL, output_dir = "export", n_lines = 30, scale_factor = 10, line_color = "black", fill_color = NULL, linewidth = 0.5, width = 800, height = 200, closed = TRUE )
elevation |
A raster object containing elevation data, as returned by get_elevation() |
output_dir |
Directory where SVG files will be saved (default: "export") |
n_lines |
Number of ridgelines to generate (default: 30) |
scale_factor |
Scaling factor for the height of ridgelines (default: 10) |
line_color |
Color of the ridgelines (default: "black") |
fill_color |
Color to fill closed shapes (default: same as line_color). Only used when closed = TRUE |
linewidth |
Width of the ridgelines (default: 0.5) |
width |
SVG width in pixels (default: 800) |
height |
SVG height in pixels (default: 200) |
closed |
Logical; if TRUE, creates closed shapes by adding a baseline (default: FALSE) |
Invisibly returns the paths to the created SVG files
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.
get_elevation(bb = NULL, z = 9)get_elevation(bb = NULL, z = 9)
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. |
A raster object containing elevation data
# Using the included Wilder Kaiser bounding box elevation <- get_elevation(bb_wilder_kaiser) plot_elevation() # Using a higher zoom level for more detail detailed_elevation <- get_elevation(bb_wilder_kaiser, z = 12) plot_elevation()# Using the included Wilder Kaiser bounding box elevation <- get_elevation(bb_wilder_kaiser) plot_elevation() # Using a higher zoom level for more detail detailed_elevation <- get_elevation(bb_wilder_kaiser, z = 12) plot_elevation()
Creates a visualization of elevation data using contour lines. This function provides a way to visualize terrain elevation changes through isolines.
plot_contours( elevation = NULL, interval = 100, line_color = "black", linewidth = 0.25, color_by_elevation = "none", low_color = "darkblue", high_color = "darkred", fill_alpha = 1 )plot_contours( elevation = NULL, interval = 100, line_color = "black", linewidth = 0.25, color_by_elevation = "none", low_color = "darkblue", high_color = "darkred", fill_alpha = 1 )
elevation |
A raster object containing elevation data, as returned by get_elevation() |
interval |
Elevation interval between contour lines in meters (default: 100) |
line_color |
Color of the contour lines (default: "black") |
linewidth |
Width of the contour lines (default: 0.25) |
color_by_elevation |
How to color elevation: "none", "lines", "fill", or "both" (default: "none") |
low_color |
Color for lowest elevations when coloring by elevation (default: "darkblue") |
high_color |
Color for highest elevations when coloring by elevation (default: "darkred") |
fill_alpha |
Alpha transparency for fill color (default: 1) |
A ggplot object that can be further customized using ggplot2 functions
# Create a basic contour plot plot_contours(ele_wilder_kaiser) # Customize contour interval and appearance plot_contours(ele_wilder_kaiser, interval = 50, line_color = "darkred", linewidth = 0.1 ) # Color contours by elevation plot_contours(ele_wilder_kaiser, color_by_elevation = "lines") # Color fill by elevation plot_contours(ele_wilder_kaiser, color_by_elevation = "fill") # Color both lines and fill by elevation plot_contours(ele_wilder_kaiser, color_by_elevation = "both")# Create a basic contour plot plot_contours(ele_wilder_kaiser) # Customize contour interval and appearance plot_contours(ele_wilder_kaiser, interval = 50, line_color = "darkred", linewidth = 0.1 ) # Color contours by elevation plot_contours(ele_wilder_kaiser, color_by_elevation = "lines") # Color fill by elevation plot_contours(ele_wilder_kaiser, color_by_elevation = "fill") # Color both lines and fill by elevation plot_contours(ele_wilder_kaiser, color_by_elevation = "both")
Creates a heatmap visualization of elevation data. This function provides a quick way to visualize the terrain in your area of interest.
plot_elevation(elevation = NULL, low_color = "darkblue", high_color = "white")plot_elevation(elevation = NULL, low_color = "darkblue", high_color = "white")
elevation |
A raster object containing elevation data, as returned by get_elevation() |
low_color |
Color for lowest elevations (default: "darkblue") |
high_color |
Color for highest elevations (default: "white") |
A ggplot object that can be further customized using ggplot2 functions
# Create a basic elevation plot plot_elevation(ele_wilder_kaiser) # Customize colors plot_elevation(ele_wilder_kaiser, low_color = "darkgreen", high_color = "yellow")# Create a basic elevation plot plot_elevation(ele_wilder_kaiser) # Customize colors plot_elevation(ele_wilder_kaiser, low_color = "darkgreen", high_color = "yellow")
Creates topographical elevation ridgeline plots, inspired by the iconic Joy Division album cover.
plot_ridgelines( elevation = NULL, n_lines = 30, scale_factor = 10, line_color = "white", fill_color = "#FFFFFF1A", linewidth = 0.5, background_color = "black" )plot_ridgelines( elevation = NULL, n_lines = 30, scale_factor = 10, line_color = "white", fill_color = "#FFFFFF1A", linewidth = 0.5, background_color = "black" )
elevation |
A raster object containing elevation data, as returned by get_elevation() |
n_lines |
Number of ridgelines to draw (default: 30). More lines create a denser visualization but may increase plotting time. |
scale_factor |
Scaling factor for the height of ridgelines (default: 10). Higher values make the elevation differences more pronounced. |
line_color |
Color of the ridgelines (default: "white") |
fill_color |
Fill color below the lines (default: "#FFFFFF1A", semi-transparent white) |
linewidth |
Width of the ridgelines (default: 0.5) |
background_color |
Background color of the plot (default: "black") |
A ggplot object that can be further customized using ggplot2 functions
# Default style (white on black) plot_ridgelines(ele_wilder_kaiser) # No fill, just lines plot_ridgelines( ele_wilder_kaiser, fill_color = NA, scale_factor = 12 ) # Classic black on white style plot_ridgelines( ele_wilder_kaiser, line_color = "#000000", fill_color = "white", background_color = "white", scale_factor = 8 ) # Get creative! plot_ridgelines( ele_wilder_kaiser, n_lines = 35, line_color = "#FF4081", fill_color = "#FF408133", background_color = "#1A237E" )# Default style (white on black) plot_ridgelines(ele_wilder_kaiser) # No fill, just lines plot_ridgelines( ele_wilder_kaiser, fill_color = NA, scale_factor = 12 ) # Classic black on white style plot_ridgelines( ele_wilder_kaiser, line_color = "#000000", fill_color = "white", background_color = "white", scale_factor = 8 ) # Get creative! plot_ridgelines( ele_wilder_kaiser, n_lines = 35, line_color = "#FF4081", fill_color = "#FF408133", background_color = "#1A237E" )