Contents
How to convert SFC _ point to x, y columns?
For the most part, so far so good. One step I can’t quite figure out how to replicate converting an sf data.frame with an sfc_POINT geometry column into a data.frame with separate x and y columns. Is there a better (simpler) approach I’m not seeing?
How to transform coordinates of simple feature geometries?
Projecting simple feature geometries to projections not supported by GDAL may be done by st_transform_proj, part of package lwgeom. #> Geometry set for 2 features #> Geometry type: POINT #> Dimension: XY #> Bounding box: xmin: -30 ymin: 20 xmax: 7 ymax: 52 #> Geodetic CRS: WGS 84
How does the St transform function in SFG work?
Transforms coordinates of object to new projection. Features that cannot be transformed are returned as empty geometries. The st_transform method for sfg objects assumes that the CRS of the object is available as an attribute of that name.
How to create multiple lines with SF package?
I think that the sf package need to know first how you want to create the lines from your points. I mean which pair of POINT make every LINESTRING. In my example that was defined inside the lapply function. Follow the reproducible and commented code below, hope that helps:
Do you use data.table for SFG points?
I use data.table for speed-reasons (10,000s of thousands of points that are also analysed without geographical aspects). I think I need an sfc of sfg-points, and not a MULTIPOINT-sfg. Have you tried st_as_sf () which converts object (sp, dataframe.) to an sf object?
How to unlist geometry into two column matrix?
A possible approach is to unlist it. Data structure check with str (df) shows, that a variable – geometry – is in list format, which can be unhandy. A way to solve this is to unlist () it, transform it into a 2-column matrix, and reassemble it with the first column. With setNames () we are able to assign new column names in one step.