This function adds a compact control that displays the cursor position as longitude and latitude in WGS84 coordinates.
Usage
add_coordinates_control(
map,
position = "bottom-right",
format = c("decimal", "dms"),
precision = NULL,
label = NULL,
empty_text = "Move cursor over map",
wrap = TRUE
)Arguments
- map
A map object created by the
mapboxglormaplibrefunctions.- position
The position of the control. Can be one of "top-left", "top-right", "bottom-left", or "bottom-right". Default is "bottom-right".
- format
Coordinate display format. One of
"decimal"for decimal degrees or"dms"for degrees, minutes, and seconds.- precision
Number of decimal places to display. If
NULL, defaults to 5 for decimal degrees and 1 for DMS seconds. Forformat = "dms", this controls decimal places for seconds.- label
Optional label shown above the coordinates. Default is
NULL.- empty_text
Text shown before the cursor enters the map, and after it leaves the map.
- wrap
Logical. If
TRUE, longitudes are wrapped to the standard[-180, 180]range. Default isTRUE.
