Get the coordinates of the extent of a map
map_extent.Rd
Helper function for creating custom map elements that are aligned with the axes of a map (base plot created with a SpatRaster and/or SpatVector). For example, you may need to know the coordinates for the upper-left corner of a map to add some information there.
Unlike the standard base plot, terra keeps the axis aligned with the data. For that reason you cannot use par()$usr
to get these coordinates.
The coordinates returned by this function are used in, for example, add_legend
such that a legend can be automatically placed in the a particular corner.
This function only returns meaningful results of the active plot (canvas) was create with a call to plot
with a SpatRaster or SpatVector as first argument.