Open Zedseayou opened 5 years ago
Number 1 is certainly feasible and I think will just mean attaching sfc
attributes here.
We can also add functionality so a data.frame of polylines gets decoded into an sf
object.
Example data to work with
polylines <- c(
"ohlbDnbmhN~suq@am{tAw`qsAeyhGvkz`@fge}A",
"ggmnDt}wmLgc`DesuQvvrLofdDorqGtzzV"
)
## option to convert to `sfc`
decode(polylines)
df <- data.frame(
id = 1:2
, pl = polylines
)
## this will then get converted to `sf`
# decode(df)
For Number 2 are you after
df <- data.frame(
geom = "POINT(0 1)"
)
sf::st_as_sf(df, wkt = "geom")
Thanks for this cool package! I currently have a use case where I get given a long vector of polylines, and I'm wondering whether it makes sense to have one of:
decode
that produces ansf
object instead of requiring the user to convert the list of dataframes themselves.sfencoded
that does the work of creating an encoded column and sets class so thatpolyline_wkt %>% st_as_sf
can be used.Both of these are certainly convenience functions. I can try a PR in the next few days once I read over the code a bit also.