jmsigner / amt

37 stars 13 forks source link

steps() function Error in CPL_geos_dist #95

Closed radarlin21 closed 5 months ago

radarlin21 commented 1 year ago

Using GPS location data from Movebank, I am trying to generate steps from tracks made with the make_track function: _make_track(x, .x = 'lon', .y = 'lat', .t = 'time', ID, sex, age, crs = 5070, order_by_ts = T, allcols = T)

When I run the following: _steps(x, lonlat = TRUE, keep_cols = "end", diff_timeunits = "auto")

This error occurs: _Error in CPL_geosdist(x, y, which, par) : wrong value for op: please report as issue

I had previously not defined the crs in make_track, and left lonlat = FALSE in steps(), but the step length values generated are in an unclear unit (probably decimal degrees?), which makes it challenging to double check outputs against observed step distances I generated separately in km.

bsmity13 commented 1 year ago

Hi @radarlin21. In make_track(), you're specifying the CRS as EPSG:5070, which is a projected coordinate system (with units in meters). If your data are the raw GPS lat/lon, you most likely want to specify crs = 4326 and then use transform_coords() to convert to 5070. In that case, use steps(..., lonlat = FALSE) and the units will all be in meters.

Does that fix your problem?