Hi Zehudil,
I'm not sure if you've solved this yet, but I had the same problem.
What worked for me was transforming the longitude and latitude into a Cartesian (meter-based) projection and then exporting it as a new csv file.
This is the code I used:
library(ctmm)
library(dplyr)
library(sf)
library(ggplot2)
library(sf)
library(rgdal)
library(sp)
#load data
data <- read.csv("your_data.csv")
str(data)
# Rename columns for easier use with ctmm if needed
colnames(data)[which(names(data) == "location.lat")] <- "latitude"
colnames(data)[which(names(data) == "location.long")] <- "longitude"
colnames(data)[which(names(data) == "individual.local.identifier")] <- "ID" # if necessary
# Define the UTM projection (e.g., Zone 35S for South Africa)
utm_crs <- st_crs(32735)
# Convert your data frame to an sf object
sf_data <- st_as_sf(data, coords = c("longitude", "latitude"), crs = 4326)
# Transform to UTM (to get coordinates in meters)
sf_data_utm <- st_transform(sf_data, crs = utm_crs)
# Extract UTM coordinates
utm_coords <- st_coordinates(sf_data_utm)
# Add UTM coordinates (easting and northing) to your data, this is the Cartesian projection values
data$utm_easting <- utm_coords[, 1]
data$utm_northing <- utm_coords[, 2]
# Save the updated data frame to a new CSV file
write.csv(data, "your_data_new_csv_name.csv", row.names = FALSE)
#loading in the new csv file with updated UTM values)
data2 <- read.csv("
your_data_new_csv_name .csv")
#rename other columns if needed
colnames(data2)[which(names(data) == "utm_easting")] <- "x"
colnames(data2)[which(names(data) == "utm_northing")] <- "y"
colnames(data2)[which(names(data2) == "individual.local.identifier")] <- "ID"
# Convert data to telemetry object with correct projection (UTM Zone 35S), set the CRS as needed
tel <- as.telemetry(data2, projection = CRS("+init=epsg:32735"))
plot(tel)
I hope this helps,
All the best,
Cleo