joelgombin / concaveman

A very fast 2D concave hull algorithm
https://joelgombin.github.io/concaveman/
66 stars 7 forks source link

Using concaveman with dplyr #8

Closed grobins closed 5 years ago

grobins commented 5 years ago

I have a sf dataframe with 12million points, and an region column with 20 unique values. I want to create a concave hull for each of the 20 unique regions.

sf1 %>% 
    group_by(region) %>%  
    summarise(conv_hull = concaveman(points = geometry, concavity = 1.8, length_threshold = 0.0001))

But I get the error Error: Evaluation error: no applicable method for 'concaveman' applied to an object of class "c('sfc_POINT', 'sfc')".

Any help around this would be appreciated

joelgombin commented 5 years ago

Sorry I didn't answer this! without a reprex it's a bit difficult to help you, but I think what you might be looking for is something along the lines of the example in the README of this repo: you need to use purrr::map to iterate over the groups.

joelgombin commented 4 years ago

it could be a good idea though ti implement a method for sfc. I'll have a look.