0

I'm using the selectFeatures function within the R package called mapedit. I want to be able to select all polygons that fall within (either wholly or partially) an area drawn using the tools in the mapedit viewer.

Using the following code from the (mapedit doc) the click mode works. However, when I change the mode to draw and then complete a drawing using any tool it produces the error below and the map is removed from the viewer and nothing is stored in the object (in this case selected2).

library(mapview)
library(mapedit)
library(sf)

nc <- st_read(system.file("shape/nc.shp", package="sf"))
selected <- selectFeatures(nc, mode = 'click')
selected2 <- selectFeatures(nc, mode = 'draw')

Warning: Error in st_read.default: no st_read method available for objects of class json

Is there a step I'm missing?

Also, would someone with higher priveledges than me kindly create a r-mapedit tag?

TimSalabim
  • 5,604
  • 1
  • 25
  • 36
Jody Biggs
  • 35
  • 1
  • 5
  • Using mapedit version 0.4.1., I cannot reproduce your error. Everything works as expected. – TimSalabim Jun 20 '18 at 08:10
  • Hi Tim, Strange... I'm using the same version of mapedit (0.4.1). What version of R did you test it with? I was using R v3.4.4 because of compatibility problems with a particular package. – Jody Biggs Jun 20 '18 at 22:28
  • Tested on both windows w R 3.5.0 and ubuntu w R 3.4.4 without any issues. – TimSalabim Jun 21 '18 at 05:41

1 Answers1

0

I was able to solve the problem by updating from R v3.4.4 to R v3.5.0.

Jody Biggs
  • 35
  • 1
  • 5