ropensci / osmplotr

Data visualisation using OpenStreetMap objects
https://docs.ropensci.org/osmplotr
132 stars 21 forks source link

using sf operations #35

Closed richardbeare closed 6 years ago

richardbeare commented 6 years ago

Hi, More of a query really. I'm playing around applying sf operations to osmplotr data. But there seem to be problems having the packages loaded at the same time:

library(sf)
library(osmplotr)
data(london)
london$dat_BR
Error in .subset2(x, i, exact = exact) : 
  attempt to select less than one element in get1index

Any way to safely apply sf operations to the london data set, which appears to be set up using the sf structures?

richardbeare commented 6 years ago

Still having the same problem with the highways:

> london$dat_H
Error in .subset2(x, i, exact = exact) : 
  attempt to select less than one element in get1index
> london$dat_HP
Error in .subset2(x, i, exact = exact) : 
  attempt to select less than one element in get1index

Everything else OK

mpadge commented 6 years ago

thanks @richardbeare, and yeah, i got that too. just repeated the same trick. This now runs clear for me:

library (osmplotr)
library (sf)
for (n in names (london)) print (london [[n]])

I've no idea what the root cause is - some clash beween R's internal "xz" compression algorithm and slight differences in the way osmdata constructs sf objects versus how sf actually does it? Let me know if it works now please