joelgombin / concaveman

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

Use of numeric coordinates #11

Open JolleJolles opened 4 years ago

JolleJolles commented 4 years ago

I am trying to get concaveman to work with a matrix of spatial (numeric) coordinates, e.g. like mat <- matrix(c(c(1,1),c(3,1),c(2,4)), ncol=2). How can I make this work?

In the description it is stated "points can be represented as a matrix of coordinates", but not that these points cannot be numeric or how to convert them.

I came upon your package via the ggforce package, which does a great job in plotting my points with the concave hull, but I don't know how to extract the computed points.

JolleJolles commented 4 years ago

I found that the following command helps to get the right data for concaveman from a dataframe with x,y data: dat_sf <- st_as_sf(data,c("x","y")], coords = c("x", "y"), crs = 28992), but any further clarifications would be appreciated.

joelgombin commented 4 years ago

I'm not quite sure what your question is. The following works for me:

mat <- matrix(c(c(1,1),c(3,1),c(2,4)), ncol=2)

library(concaveman)
concaveman(mat)

Could you provide a reprex of something you wish worked but doesn't?