Learn R Programming

quickPlot (version 1.0.2)

coordinates: Extract coordinates from a variety of spatial objects

Description

This will extract using terra::crds, sf::st_coordinates and raster::coordinates. Other packages can create methods, as this is generic.

Usage

# S4 method for ANY
coordinates(obj, ...)

Value

A 2 column matrix of coordinates (x and y)

Arguments

obj

An object from which to extract the coordinates (e.g., sf, sp)

...

Ignored.

Examples

Run this code
library(terra)
caribou <- terra::vect(x = cbind(x = stats::runif(1e1, -50, 50),
                                        y = stats::runif(1e1, -50, 50)))
coordinates(caribou)

Run the code above in your browser using DataLab