mstrimas / smoothr

Spatial Feature Smoothing in R
http://strimas.com/smoothr
GNU General Public License v3.0
96 stars 5 forks source link

Error: is_count(refinements) is not TRUE #8

Closed vojta-bartak closed 3 years ago

vojta-bartak commented 3 years ago

I'm trying to smooth a sf object with LINESTRING sfc (one single feature only), following the package vignette.

Am I doing anything wrong?

Thanks!

mstrimas commented 3 years ago

Can you provide a reproducible code example? For example, this works fine for me:

library(sf)
library(smoothr)

l <- st_sfc(st_linestring(matrix(c(0, 0.25, 1, 0, 0.75, 1), ncol = 2)))
s_ch <- smooth(l, method = "chaikin")
s_ks <- smooth(l, method = "ksmooth")
s_sp <- smooth(l, method = "spline")
plot(l)
plot(s_ch, col = "red", add = TRUE)
plot(s_ks, col = "blue", add = TRUE)
plot(s_sp, col = "green", add = TRUE)
smooth
vojta-bartak commented 3 years ago

It was my stupid mistake as I improperly used pipeline notation and repeated the object to be smoothed as an argument of smooth, i.e. instead of line %>% smooth(method = ...) I wrote line %>% smooth(line, method = ...). I apologize for stealing your time, I was just blind.