Skip to contents

Map creation

Function to create maps

map()
Create a MapLibre map widget

Data sources

Functions to interact with map data sources

add_source()
Add a source to the map
set_source_data()
Set data for a source on the map
add_feature_server_source()
Add a FeatureService source to the map
add_image()
Add an image source to the map

Adding layers

Functions to add map layers

add_layer()
Add a layer to a map or map proxy
add_fill_layer()
Add a fill layer to a map or map proxy
add_circle_layer()
Add a circle layer to a map or map proxy
add_line_layer()
Add a line layer to a map or map proxy
add_symbol_layer()
Add a symbol layer to a map or map proxy
add_text_layer()
Add a text layer to a map or map proxy
add_lat_lng_grid()
Add a grid of latitude and longitude lines to the map

Updating layers

Functions to update map layers

show_layer()
Show a previously hidden layer on the map
hide_layer()
Hide a layer from the map
toggle_clustering()
Toggle clustering for a layer on the map
toggle_lat_lng_grid()
Show/hide the latitude and longitude grid on the map

Layer styling

Functions to update map layer styling

set_paint_property()
Set a paint property for a layer on the map
set_layout_property()
Set a layout property for a layer on the map

Styling helpers

Functions to help with map/layer styling

get_layout_options()
Get layout options for a specific layer type
get_paint_options()
Get paint options for a specific layer type
get_layer_filter()
Get a filter for a layer
get_column()
Get a column from a dataset to use as a paint or layout option in a map layer
get_column_boolean()
Get the value for a paint or layout option in a map layer based on a column boolean value
get_column_group()
Get the values for a paint or layout option in a map layer based on a column value
get_column_steps()
Get the properties for a column in a map layer based on step breaks

Map tiles

Functions to update map tiles

set_tile_layer()
Set the tile layer for the map
get_tile_options()
Get available tile layer options

Map view

Functions to manipulate the map view

set_zoom()
Set the map zoom level
set_bounds()
Set the map bounds

Map interaction

Functions to get information from map interaction

get_clicked_feature()
Get the sf data frame of a clicked feature from the map widget
get_drawn_shape()
Get the drawn shape from the map widget

Controls - Basic

Simple map controls

toggle_control()
Toggle the visibility of a control on the map
remove_control()
Remove a control from the map

Controls - Drawing tools

Controls for draw/edit workflows

add_draw_control()
Add a draw control to the map
remove_draw_control()
Remove the draw control from the map
delete_drawn_shape()
Delete a drawn shape from the map

Controls - View tools

Controls for map view manipulation

add_zoom_control()
Add a zoom control to the map
remove_zoom_control()
Remove the zoom control from the map

Controls - Layer tools

Controls for updating map layers

add_tile_selector_control()
Add a tile selector control to the map or control panel
remove_tile_selector_control()
Remove the tile selector control from the map
add_layer_selector_control()
Add a layer selector control to the map or control panel
remove_layer_selector_control()
Remove the layer selector control from the map
add_cluster_toggle()
Add a cluster toggle control to the map or control panel
remove_cluster_toggle()
Remove a cluster toggle control from the map
add_visibility_toggle()
Add a visibility toggle control to the map or control panel
remove_visibility_toggle()
Remove a visibility toggle control from the map

Controls - Animation tools

Controls for performing map animations

add_route()
Add a route to a toro map which can be animated
play_route()
Play a route animation on a toro map
pause_route()
Pause a route animation on a toro map
remove_route()
Remove an animation route from a toro map
add_timeline_control()
Add a timeline control to the map or control panel
remove_timeline_control()
Remove the timeline control from the map
add_speed_control()
Add a speed control to the map or control panel
remove_speed_control()
Remove the speed control from the map
add_animation_controls()
Add animation controls to a toro map

Controls - Misc

Additional interactive controls

add_cursor_coords_control()
Add a cursor coordinates control to the map
remove_cursor_coords_control()
Remove the cursor coordinates control from the map
add_custom_control()
Add a custom HTML control to the map
remove_custom_control()
Remove a custom control from the map
add_cluster_toggle()
Add a cluster toggle control to the map or control panel

Control panels

Functions to add/edit control panels for map interaction

add_control_panel()
Add a control panel to the map
add_control_group()
Add a control group to a control panel
remove_control_group()
Remove a control group from a control panel
remove_control_from_panel()
Remove a control from a control panel

Shiny integration

Functions to get information from map interaction

mapOutput()
Create a MapLibre GL output for use in Shiny
renderMap()
Render a MapLibre GL map in Shiny
mapProxy()
Create a proxy object for updating the map

Extra features

Additional functions

export_map_image()
Export map as an image (non-Shiny context)
save_map_html()
Save map as standalone HTML file