concaveman icon indicating copy to clipboard operation
concaveman copied to clipboard

Use of numeric coordinates

Open JolleJolles opened this issue 4 years ago • 2 comments

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 avatar May 01 '20 10:05 JolleJolles

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.

JolleJolles avatar May 01 '20 10:05 JolleJolles

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?

joelgombin avatar May 10 '20 22:05 joelgombin