geoplyr icon indicating copy to clipboard operation
geoplyr copied to clipboard

Experiment with converting sp objects into nested dataframes

Open eamcvey opened this issue 9 years ago • 1 comments

eamcvey avatar Apr 01 '16 18:04 eamcvey

I've been experimenting with this here:

https://github.com/mdsumner/spbabel

I see three main ways to do it

  • one-level nesting with the equivalent of fortify(x) in each of x's rows
  • two-level nesting, with each fortify(x) turned further into parts(x_i) with a table of verts for each part
  • just store sp::geometry(x) as a list column
  • turn this inside out, and store a single table with rows Objects (same as x), Parts, and Vertices

The first three are pretty straightforward, and easy to convert between - but you cannot then store topology (shared vertices), you cannot reduce down to a table of unique vertices. I'm very interested to go further down this road, but I also see the df nesting is very valuable - it's the easiest way to dplyr-ize Spatial and I really think that's a good thing to do.

I hope this is of interest.

mdsumner avatar Apr 11 '16 12:04 mdsumner