coordinates: Extract coordinates from a variety of spatial objects

coordinatesR Documentation

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 signature 'ANY'
coordinates(obj, ...)

Arguments

obj

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

...

Ignored.

Value

A 2 column matrix of coordinates (x and y)

Examples

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


quickPlot documentation built on Aug. 8, 2025, 7:17 p.m.